home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / maximus / mul100.zip / MULFNREF.DOC < prev    next >
Text File  |  1992-09-01  |  101KB  |  4,419 lines

  1.  
  2.                 MUL INTERPRETER INTRINSIC FUNCTIONS REFERENCE
  3.  
  4. ----------------------------------------------------------------------
  5.  
  6. NAME
  7.     About
  8.  
  9. DESCRIPTION
  10.     Opens an about window that lists the current MUL version and
  11.     Copyright notice.
  12.  
  13. SYNOPSIS
  14.     void About (int row_offset)
  15.  
  16. INPUTS
  17.     row_offset  -   Optional screen offset for window display.
  18.  
  19. RETURN VALUE
  20.     None
  21.  
  22. ALSO SEE
  23.     IDENT  VERSN
  24.  
  25. EXAMPLE
  26.     main ()
  27.     {
  28.         About ();           // Open the about window
  29.         Hidecur ();         // Hide the cursor
  30.         while (!kbhit()) ;  // Wait until key hit
  31.         getch ();           // Clear the key
  32.         Wclose ();          // Close the about window
  33.         Showcur ();         // Show the cursor
  34.     }
  35.  
  36. ----------------------------------------------------------------------
  37.  
  38. NAME
  39.     And
  40.  
  41. DESCRIPTION
  42.     Returns the bitwise AND of the two arguments. At the bit level,
  43.     that is for each bit in the two arguments, a bitwise AND results
  44.     in "only two one's make a one".
  45.  
  46. SYNOPSIS
  47.     long And (long arg1, long arg2)
  48.  
  49. INPUTS
  50.     arg1        -   First value.
  51.     arg2        -   Second value.
  52.  
  53. RETURN VALUE
  54.     Value of the bitwise AND.
  55.  
  56. ALSO SEE
  57.     Or  Xor  Invert  ShiftLeft  ShiftRight
  58.  
  59. EXAMPLE
  60.     main ()
  61.     {
  62.         if (BaseOpen ("USER.BBS")) {            // Open user base
  63.             if (BaseRead (1)) {                 // Read first (sysop) record
  64.                 if (And (USRxpflag,XP_DATE))
  65.                     printf ("Sysop expiry by date is Active\n");
  66.                 else
  67.                     printf ("Sysop expiry by date is Inactive\n");
  68.             }
  69.             else printf ("Base open failed!\n");
  70.             BaseClose ();                       // Close user base
  71.         }
  72.     }
  73.  
  74. ----------------------------------------------------------------------
  75.  
  76. NAME
  77.     atoi
  78.  
  79. DESCRIPTION
  80.     Convert a decimal character string to an integer value.
  81.  
  82. SYNOPSIS
  83.     int atoi (char *str)
  84.  
  85. INPUTS
  86.     str         -   Decimal character string.
  87.  
  88. RETURN VALUE
  89.     Integer value of str.
  90.  
  91. ALSO SEE
  92.     sign  itoa  ltoa  atol
  93.  
  94. EXAMPLE
  95.     main ()
  96.     {
  97.         int var;
  98.  
  99.         var = atoi ("42");
  100.         printf ("Value is %d\n",var);
  101.     }
  102.  
  103. ----------------------------------------------------------------------
  104.  
  105. NAME
  106.     atol
  107.  
  108. DESCRIPTION
  109.     Convert a decimal character string to a long value.
  110.  
  111. SYNOPSIS
  112.     long atoi (char *str)
  113.  
  114. INPUTS
  115.     str         -   Decimal character string.
  116.  
  117. RETURN VALUE
  118.     Long value of str.
  119.  
  120. ALSO SEE
  121.     sign  itoa  ltoa  atoi
  122.  
  123. EXAMPLE
  124.     main ()
  125.     {
  126.         long var;
  127.  
  128.         var = atol ("42");
  129.         printf ("Value is %ld\n",var);
  130.     }
  131.  
  132. ----------------------------------------------------------------------
  133.  
  134. NAME
  135.     Attr
  136.  
  137. DESCRIPTION
  138.     Return a foreground/background colour attribute.
  139.  
  140. SYNOPSIS
  141.     int Attr (int foreground, int background)
  142.  
  143. INPUTS
  144.     foreground  - Foreground colour attribute.
  145.     background  - Optional background colour attribute.
  146.  
  147. RETURN VALUE
  148.     Colour attribute value.
  149.  
  150. ALSO SEE
  151.     Avt
  152.  
  153. EXAMPLE
  154.     main ()
  155.     {
  156.         char colour;
  157.  
  158.         colour = Attr (WHITE,RED);
  159.  
  160.         if (Wopen (16,21,20,59,0,colour,colour)) {
  161.             Wxyputs (1,1,colour,"    Press any key to continue ..");
  162.             Hidecur ();         // Hide the cursor
  163.             while (!kbhit()) ;  // Wait until key hit
  164.             getch ();           // Clear the key
  165.             Wclose ();          // Close the window
  166.             Showcur ();         // Show the cursor
  167.         }
  168.     }
  169.  
  170. ----------------------------------------------------------------------
  171.  
  172. NAME
  173.     Avt
  174.  
  175. DESCRIPTION
  176.     Return character pointer to an avatar colour string.
  177.  
  178. SYNOPSIS
  179.     char * Avt (int foreground, int background)
  180.  
  181. INPUTS
  182.     foreground  - foreground colour attribute.
  183.     background  - optional background colour attribute.
  184.  
  185. RETURN VALUE
  186.     Avatar colour string.
  187.  
  188. ALSO SEE
  189.     Attr
  190.  
  191. EXAMPLE
  192.     main ()
  193.     {
  194.         long fp;
  195.         char colour[5];
  196.         char MENTER=0x01; // Maximus 'press enter'
  197.  
  198.         strcpy (colour,Avt (WHITE,BLACK));
  199.         fp = fopen ("ONLINE.BBS","wb");
  200.  
  201.         if (fp != NULL) {
  202.             fprintf (fp,"%s%c",colour,MENTER);
  203.             fclose (fp);
  204.         }
  205.         else printf ("File open failed!\n");
  206.     }
  207.  
  208. ----------------------------------------------------------------------
  209.  
  210. NAME
  211.     BaseAppend
  212.  
  213. DESCRIPTION
  214.     Append a new record to the Maximus user file.
  215.  
  216. SYNOPSIS
  217.     int BaseAppend (void)
  218.  
  219. INPUTS
  220.     None
  221.  
  222. RETURN VALUE
  223.     TRUE on success, FALSE on failure.
  224.  
  225. ALSO SEE
  226.     BaseOpen  BaseOpenR  BaseClose  BaseRead  BaseWrite
  227.  
  228. EXAMPLE
  229.     main ()
  230.     {
  231.         if (BaseOpen ("USER.BBS")) {    // Open user base
  232.             BaseClear ();               // Clear record buffer
  233.             BaseAppend ();              // Append new record
  234.             BaseClose ();               // Close user base
  235.         }
  236.     }
  237.  
  238. ----------------------------------------------------------------------
  239.  
  240. NAME
  241.     BaseClear
  242.  
  243. DESCRIPTION
  244.     Clears the Maximus user record buffer. Places correct default
  245.     values in the record fields as required for a blank appended
  246.     record.
  247.  
  248. SYNOPSIS
  249.     int BaseClear (void)
  250.  
  251. INPUTS
  252.     None
  253.  
  254. RETURN VALUE
  255.     None
  256.  
  257. ALSO SEE
  258.     BaseAppend
  259.  
  260. EXAMPLE
  261.     main ()
  262.     {
  263.         if (BaseOpen ("USER.BBS")) {    // Open user base
  264.             BaseClear ();               // Clear record buffer
  265.             BaseAppend ();              // Append new record
  266.             BaseClose ();               // Close user base
  267.         }
  268.     }
  269.  
  270. ----------------------------------------------------------------------
  271.  
  272. NAME
  273.     BaseClose
  274.  
  275. DESCRIPTION
  276.    Close the Maximus user file.
  277.  
  278. SYNOPSIS
  279.     int BaseClose (void)
  280.  
  281. INPUTS
  282.     None
  283.  
  284. RETURN VALUE
  285.     TRUE on success, FALSE on failure.
  286.  
  287. ALSO SEE
  288.     BaseOpen
  289.  
  290. EXAMPLE
  291.     main ()
  292.     {
  293.         if (BaseOpen ("USER.BBS")) { // Open user base
  294.             printf("Sysop name is %s\n",USRname);
  295.             BaseClose (); // Close user base
  296.         }
  297.     }
  298.  
  299. ----------------------------------------------------------------------
  300.  
  301. NAME
  302.     BaseCount
  303.  
  304. DESCRIPTION
  305.     Return the number of records in the Maximus user file. Only
  306.     applicable when the user file is open.
  307.  
  308. SYNOPSIS
  309.     int BaseCount (void)
  310.  
  311. INPUTS
  312.     None
  313.  
  314. RETURN VALUE
  315.     The number of records in the user file.
  316.  
  317. ALSO SEE
  318.     BaseOpen  BaseClose
  319.  
  320. EXAMPLE
  321.     main ()
  322.     {
  323.         if (BaseOpen ("USER.BBS")) { // Open user base
  324.             printf("Record count is %d\n",BaseCount ());
  325.             BaseClose (); // Close user base
  326.         }
  327.     }
  328.  
  329. ----------------------------------------------------------------------
  330.  
  331. NAME
  332.     BaseDaysLCall
  333.  
  334. DESCRIPTION
  335.     Return the number of days since last call for the current Maximus
  336.     user record, read with BaseRead. Only applicable when the user file
  337.     is open.
  338.  
  339. SYNOPSIS
  340.     int BaseDaysLCall (void)
  341.  
  342. INPUTS
  343.     None
  344.  
  345. RETURN VALUE
  346.     The number of days since last call.
  347.  
  348. ALSO SEE
  349.     BaseRead  BaseDaysXpry
  350.  
  351. EXAMPLE
  352.     main ()
  353.     {
  354.         if (BaseOpen ("USER.BBS")) { // Open user base
  355.             BaseRead (1); // Read sysop record
  356.             printf("The sysop last called %d days ago\n",BaseDaysLCall ());
  357.             BaseClose (); // Close user base
  358.         }
  359.     }
  360.  
  361. ----------------------------------------------------------------------
  362.  
  363. NAME
  364.     BaseDaysXpry
  365.  
  366. DESCRIPTION
  367.     Return the number of days until expiry for the current Maximus
  368.     user record, read with BaseRead. Only applicable when the user file
  369.     is open, and the record is set to expire by date.
  370.  
  371. SYNOPSIS
  372.     int BaseDaysXpry (void)
  373.  
  374. INPUTS
  375.     None
  376.  
  377. RETURN VALUE
  378.     The number of days until expiry.
  379.  
  380. ALSO SEE
  381.     BaseRead  BaseDaysLCall
  382.  
  383. EXAMPLE
  384.     main ()
  385.     {
  386.         if (BaseOpen ("USER.BBS")) { // Open user base
  387.             BaseRead (1); // Read sysop record
  388.             if (And (USRxpflag,XP_DATE))
  389.                 printf("The sysop expires in %d days\n",BaseDaysXpry ());
  390.             else
  391.                 printf("The sysop has no expiry date\n");
  392.             BaseClose (); // Close user base
  393.         }
  394.     }
  395.  
  396. ----------------------------------------------------------------------
  397.  
  398. NAME
  399.     BaseHelpStr
  400.  
  401. DESCRIPTION
  402.    Return character string description of Maximus user record help setting.
  403.  
  404. SYNOPSIS
  405.    char * BaseHelpStr (char help_value)
  406.  
  407. INPUTS
  408.    Help value.
  409.  
  410. RETURN VALUE
  411.    Help value string.
  412.  
  413. ALSO SEE
  414.     BaseVideoStr  BasePrivStr  BaseKeyStr  BaseProtStr  BaseXpTypStr
  415.     BaseXpActStr
  416.  
  417. EXAMPLE
  418.     main ()
  419.     {
  420.         if (BaseOpen ("USER.BBS")) { // Open user base
  421.             BaseRead (1); // Read sysop record
  422.             printf("The sysop help level is %s\n",BaseHelpStr (USRhelp));
  423.             BaseClose (); // Close user base
  424.         }
  425.     }
  426.  
  427. ----------------------------------------------------------------------
  428.  
  429. NAME
  430.     BaseIdx
  431.  
  432. DESCRIPTION
  433.     Returns the base index number for a record number. All MUL Maximus
  434.     user record numbers reference the base via an internal base index.
  435.     This index is preset to reflect file record order. The BaseSort
  436.     function sorts the base index, so that subsequent record access via
  437.     BaseRead(rec) and other access functions, result in a sorted output.
  438.     BaseIdx returns the actual record number from the base index array.
  439.  
  440. SYNOPSIS
  441.     int BaseIdx (int rec)
  442.  
  443. INPUTS
  444.     rec -   Maximus base record number, valid range of 1 to BaseCount()
  445.             inclusive.
  446.  
  447. RETURN VALUE
  448.     Base index number (zero based).
  449.  
  450. ALSO SEE
  451.     BaseSort
  452.  
  453. EXAMPLE
  454.     main ()
  455.     {
  456.         if (BaseOpen ("USER.BBS")) { // Open user base
  457.             BaseSort (IDX_FNAME); // Sort by first name
  458.             printf("First sorted user record number is %d\n",BaseIdx (2));
  459.             BaseClose ();
  460.         }
  461.     }
  462.  
  463. ----------------------------------------------------------------------
  464.  
  465. NAME
  466.     BaseKeyOff
  467.  
  468. DESCRIPTION
  469.     Sets user record buffer key value OFF.
  470.  
  471. SYNOPSIS
  472.     void BaseKeyOff (long keybit)
  473.  
  474. INPUTS
  475.     long keybit  -   Bit value of key to turn off.
  476.  
  477. RETURN VALUE
  478.     None
  479.  
  480. ALSO SEE
  481.     BaseKeyOn  KEY1 - KEYX
  482.  
  483. EXAMPLE
  484.     main ()
  485.     {
  486.         if (BaseOpen ("USER.BBS")) {    // Open user base
  487.             BaseRead (1);               // Read sysop record
  488.             BaseKeyOff (KEY1);          // Turn off key one
  489.             BaseWrite (1);              // Write sysop record
  490.             BaseClose ();               // Close user base
  491.         }
  492.     }
  493.  
  494. ----------------------------------------------------------------------
  495.  
  496. NAME
  497.     BaseKeyOn
  498.  
  499. DESCRIPTION
  500.     Sets user record buffer key value ON.
  501.  
  502. SYNOPSIS
  503.     void BaseKeyOn (long keybit)
  504.  
  505. INPUTS
  506.     long keybit  -   Bit value of key to turn on.
  507.  
  508. RETURN VALUE
  509.     None
  510.  
  511. ALSO SEE
  512.     BaseKeyOff KEY1 - KEYX
  513.  
  514. EXAMPLE
  515.     main ()
  516.     {
  517.         if (BaseOpen ("USER.BBS")) {    // Open user base
  518.             BaseRead (1);               // Read sysop record
  519.             BaseKeyOn (KEY1);           // Turn on key one
  520.             BaseWrite (1);              // Write sysop record
  521.             BaseClose ();               // Close user base
  522.         }
  523.     }
  524.  
  525. ----------------------------------------------------------------------
  526.  
  527. NAME
  528.     BaseKeyStr
  529.  
  530. DESCRIPTION
  531.     Return character string representation of Maximus user record keys
  532.     setting.
  533.  
  534. SYNOPSIS
  535.     char * BaseKeyStr (long keys, int pad)
  536.  
  537. INPUTS
  538.     keys   -   Keys value.
  539.     pad    -   Pad flag. If true, generate fixed length string, padded
  540.                with '.' characters representating missing keys.
  541.  
  542. RETURN VALUE
  543.      Character string keys representation.
  544.  
  545. ALSO SEE
  546.     BaseHelpStr  BaseVideoStr  BasePrivStr  BaseProtStr  BaseXpTypStr
  547.     BaseXpActStr
  548.  
  549. EXAMPLE
  550.     main ()
  551.     {
  552.         if (BaseOpen ("USER.BBS")) {    // Open user base
  553.             BaseRead (1);               // Read sysop record
  554.             printf("Sysop keys: %s\n",BaseKeyStr (USRkeys));
  555.             BaseClose ();               // Close user base
  556.         }
  557.     }
  558.  
  559. ----------------------------------------------------------------------
  560.  
  561. NAME
  562.     BaseOpen
  563.  
  564. DESCRIPTION
  565.     Open User file for read/write access.
  566.  
  567. SYNOPSIS
  568.     int BaseOpen (char * filename)
  569.  
  570. INPUTS
  571.     filename    -   User file path and name string.
  572.  
  573. RETURN VALUE
  574.     TRUE on success, FALSE on failure.
  575.  
  576. ALSO SEE
  577.     BaseOpenR  BaseClose
  578.  
  579. EXAMPLE
  580.     main ()
  581.     {
  582.         char fname[80];
  583.  
  584.         strcpy (fname,"USER.BBS");
  585.  
  586.         if (BaseOpen (fname)) { // Open user base
  587.             printf("%s open for read/write access, with %d records\n",
  588.                 fname,BaseCount ());
  589.             BaseClose (); // Close user base
  590.         }
  591.     }
  592.  
  593. ----------------------------------------------------------------------
  594.  
  595. NAME
  596.     BaseOpenR
  597.  
  598. DESCRIPTION
  599.     Open User file for read access. Same as BaseOpen except that write
  600.     access is blocked (BaseWrite calls will always fail).
  601.  
  602. SYNOPSIS
  603.     int BaseOpenR (char * filename)
  604.  
  605. INPUTS
  606.     filename    -   User file path and name string.
  607.  
  608. RETURN VALUE
  609.     TRUE on success, FALSE on failure.
  610.  
  611. ALSO SEE
  612.     BaseOpen  BaseClose
  613.  
  614. EXAMPLE
  615.     main ()
  616.     {
  617.         char fname[80];
  618.  
  619.         strcpy (fname,"USER.BBS");
  620.  
  621.         if (BaseOpenR (fname)) { // Open user base
  622.             printf("%s open for read access, with %d records\n",
  623.                 fname,BaseCount ());
  624.             BaseClose (); // Close user base
  625.         }
  626.     }
  627.  
  628. ----------------------------------------------------------------------
  629.  
  630. NAME
  631.     BasePack
  632.  
  633. DESCRIPTION
  634.     Pack the user file. BasePack rewrites an open user file, removing
  635.     non-permanent records that have the delete flag set. BasePack also
  636.     renumbers any ###.BBS custom welcome files found in the user file
  637.     directory (which is assumed to be the Maximus home directory). This
  638.     can be disabled via a MUL.INI entry. BasePack writes the user file
  639.     records using the internal index array, so that if the BaseSort
  640.     function has been called after the base was opened and prior to the
  641.     BasePack call, the new user file will be written in sorted order.
  642.  
  643. SYNOPSIS
  644.     int BasePack (char * filename)
  645.  
  646. INPUTS
  647.     filename    -   User file path and name string.
  648.  
  649. RETURN VALUE
  650.     The count of records purged plus one on success, 0 on failure.
  651.  
  652. ALSO SEE
  653.     BaseSort
  654.  
  655. EXAMPLE
  656.     main ()
  657.     {
  658.         int count;
  659.  
  660.         BaseOpen ("USER.BBS");          // Open the user base
  661.         BaseSort (IDX_FNAME);           // Sort by first name
  662.         count=BasePack ("USER.BBS");    // Rewrite the user base
  663.         BaseClose ();                   // Close the user base
  664.         if (count) printf("Pack successful, %d records deleted\n",count-1);
  665.         else printf("Pack failed!\n");
  666.     }
  667.  
  668. ----------------------------------------------------------------------
  669.  
  670. NAME
  671.     BasePrivStr
  672.  
  673. DESCRIPTION
  674.     Return character pointer to priviledge level string.
  675.  
  676. SYNOPSIS
  677.     char * BasePrivStr (int priv)
  678.  
  679. INPUTS
  680.     priv    -   Maximus user base priviledge level
  681.  
  682. RETURN VALUE
  683.     Priviledge level description string.
  684.  
  685. ALSO SEE
  686.     BaseHelpStr  BaseVideoStr  BaseKeyStr  BaseProtStr  BaseXpTypStr
  687.     BaseXpActStr
  688.  
  689. EXAMPLE
  690.     main ()
  691.     {
  692.         int rec=1;
  693.  
  694.         if (BaseOpen ("USER.BBS")) {            // Open the user base
  695.             while (BaseRead (rec++))            // For all records
  696.                 // List name and priviledge
  697.                 printf("%4d %-35s %s\n",rec-1,USRname,BasePrivStr (USRpriv));
  698.  
  699.             BaseClose ();                       // Close the user base
  700.         }
  701.     }
  702.  
  703. ----------------------------------------------------------------------
  704.  
  705. NAME
  706.     BaseProtStr
  707.  
  708. DESCRIPTION
  709.     Return character pointer to default transfer protocol string.
  710.  
  711. SYNOPSIS
  712.     char * BaseProtStr (int protocol)
  713.  
  714. INPUTS
  715.     protocol    -   Maximus user base default protocol setting
  716.  
  717. RETURN VALUE
  718.     Default transfer protocol description string.
  719.  
  720. ALSO SEE
  721.     BaseHelpStr  BaseVideoStr  BasePrivStr  BaseKeyStr  BaseXpTypStr
  722.     BaseXpActStr
  723.  
  724. EXAMPLE
  725.     main ()
  726.     {
  727.         int rec=1;
  728.  
  729.         if (BaseOpen ("USER.BBS")) {            // Open the user base
  730.             while (BaseRead (rec++))            // For all records
  731.                 // List name and default protocol
  732.                 printf("%4d %-35s %s\n",rec-1,USRname,BaseProtStr (USRdefprot));
  733.  
  734.             BaseClose ();                       // Close the user base
  735.         }
  736.     }
  737.  
  738. ----------------------------------------------------------------------
  739.  
  740. NAME
  741.     BaseRead
  742.  
  743. DESCRIPTION
  744.     Read a User file record. Applicable only after a successful
  745.     BaseOpen call. BaseRead copies the specified user record from
  746.     the user file into the user record buffer. All user record field
  747.     variables (USRname, etc) reference this buffer.
  748.  
  749. SYNOPSIS
  750.     int BaseRead (int rec)
  751.  
  752. INPUTS
  753.     rec -   Record number to read, range 1 to BaseCount () inclusive.
  754.  
  755. RETURN VALUE
  756.     TRUE on success, FALSE on failure.
  757.  
  758. ALSO SEE
  759.     BaseWrite  BaseOpen  BaseClose
  760.  
  761. EXAMPLE
  762.     main ()
  763.     {
  764.         int rec=1;
  765.  
  766.         if (BaseOpen ("USER.BBS")) {            // Open the user base
  767.             while (BaseRead (rec++))            // For all records
  768.                 printf("%s\n",USRname);         // List names
  769.             BaseClose ();                       // Close the user base
  770.         }
  771.     }
  772.  
  773. ----------------------------------------------------------------------
  774.  
  775. NAME
  776.     BaseSort
  777.  
  778. DESCRIPTION
  779.     Sort the user record index array. Only valid after a successful BaseOpen
  780.     function call. BaseSort sorts the internal record access array, so that
  781.     subsequent record access function calls (BaseRead, etc) result in an
  782.     apparent sorted output. BaseSort does NOT modify the on disk user file.
  783.  
  784. SYNOPSIS
  785.     int BaseSort (int sort_method)
  786.  
  787. INPUTS
  788.     sort_method - Sort method to use. There are eleven sort methods,
  789.                   including the default file order. See the IDX_* set
  790.                   of inbuild interpreter constants, listed below.
  791.                   IDX_DEFAULT, IDX_FNAME, IDX_LNAME, IDX_CITY
  792.                   IDX_PWD, IDX_DATE, IDX_PRIV, IDX_CALL, IDX_DNLD
  793.                   IDX_UPLD, IDX_PHONE.
  794.  
  795. RETURN VALUE
  796.     TRUE on success, FALSE on failure.
  797.  
  798. ALSO SEE
  799.     BasePack  BaseIdx
  800.  
  801. EXAMPLE
  802.     main ()
  803.     {
  804.         int rec=1;
  805.  
  806.         if (BaseOpen ("USER.BBS")) {        // Open the user file
  807.             BaseSort (IDX_LNAME);           // Sort by last name
  808.             while (BaseRead (rec++)) {      // For all records
  809.                 printf ("%s\n",USRname);    // Display names
  810.             }
  811.             BaseClose ();                   // Close the user file
  812.         }
  813.     }
  814.  
  815. ----------------------------------------------------------------------
  816.  
  817. NAME
  818.     BaseVideoStr
  819.  
  820. DESCRIPTION
  821.     Return character string description of Maximus user record video
  822.     setting.
  823.  
  824. SYNOPSIS
  825.     BaseVideoStr (char video_setting)
  826.  
  827. INPUTS
  828.     video_setting   -   Maximus user record video value.
  829.  
  830. RETURN VALUE
  831.     Video setting string.
  832.  
  833. ALSO SEE
  834.     BaseHelpStr  BasePrivStr  BaseKeyStr  BaseProtStr  BaseXpTypStr
  835.     BaseXpActStr
  836.  
  837. EXAMPLE
  838.     main ()
  839.     {
  840.         if (BaseOpen ("USER.BBS")) {    // Open user base
  841.             BaseRead (1);               // Read sysop record
  842.             printf("Sysop video setting: %s\n",BaseVideoStr (USRvideo));
  843.             BaseClose ();               // Close user base
  844.         }
  845.     }
  846.  
  847. ----------------------------------------------------------------------
  848.  
  849. NAME
  850.     BaseWrite
  851.  
  852. DESCRIPTION
  853.     Write a User file record. Applicable only after a successful
  854.     BaseOpen call. BaseWrite copies the user record buffer to the
  855.     specified user record. This overwrites the existing on disk file
  856.     record. BaseWrite is normally always preceeded by a BaseRead
  857.     function call.
  858.  
  859. SYNOPSIS
  860.     int BaseWrite (int rec)
  861.  
  862. INPUTS
  863.     rec -   Record number to write, range 1 to BaseCount () inclusive.
  864.  
  865. RETURN VALUE
  866.     TRUE on success, FALSE on failure.
  867.  
  868. ALSO SEE
  869.     BaseRead  BaseOpen  BaseClose
  870.  
  871. EXAMPLE
  872.     main ()
  873.     {
  874.         if (BaseOpen ("USER.BBS")) {            // Open the user base
  875.             if (BaseRead (1)) {                 // Read sysop record
  876.                 USRcredit = 10000;              // Give the sysop some credit
  877.                 BaseWrite (1);                  // Write sysop record
  878.             }
  879.             BaseClose ();                       // Close the user base
  880.         }
  881.     }
  882.  
  883. ----------------------------------------------------------------------
  884.  
  885. NAME
  886.     BaseXpActStr
  887.  
  888. DESCRIPTION
  889.     Returns the string representation of a Maximus user record expiry
  890.     action setting.
  891.  
  892. SYNOPSIS
  893.     char * BaseXpActStr (char expiry_flag)
  894.  
  895. INPUTS
  896.     expiry_flag - Maximus user base expiry setting.
  897.  
  898. RETURN VALUE
  899.     String representatioon of expiry action setting.
  900.  
  901. ALSO SEE
  902.     BaseHelpStr   BaseVideoStr  BasePrivStr  BaseKeyStr  BaseProtStr
  903.     BaseXpTypStr
  904.  
  905. EXAMPLE
  906.     main ()
  907.     {
  908.         if (BaseOpen ("USER.BBS")) {    // Open user base
  909.             BaseRead (1);               // Read sysop record
  910.             printf("Sysop expiry action: %s\n",BaseXpActStr (USRxpflag));
  911.             BaseClose ();               // Close user base
  912.         }
  913.     }
  914.  
  915. ----------------------------------------------------------------------
  916.  
  917. NAME
  918.     BaseXpTypStr
  919.  
  920. DESCRIPTION
  921.     Returns the string representation of a Maximus user record expiry
  922.     type setting.
  923.  
  924. SYNOPSIS
  925.     char * BaseXpTypStr (char expiry_flag)
  926.  
  927. INPUTS
  928.     expiry_flag - Maximus user base expiry setting.
  929.  
  930. RETURN VALUE
  931.     String representatioon of expiry type setting.
  932.  
  933. ALSO SEE
  934.     BaseHelpStr   BaseVideoStr  BasePrivStr  BaseKeyStr  BaseProtStr
  935.     BaseXpActStr
  936.  
  937. EXAMPLE
  938.     main ()
  939.     {
  940.         if (BaseOpen ("USER.BBS")) {    // Open user base
  941.             BaseRead (1);               // Read sysop record
  942.             printf("Sysop expiry type: %s\n",BaseXpTypStr (USRxpflag));
  943.             BaseClose ();               // Close user base
  944.         }
  945.     }
  946.  
  947. ----------------------------------------------------------------------
  948.  
  949. NAME
  950.     DateToStr
  951.  
  952. DESCRIPTION
  953.     Returns string representation of the date parameter.
  954.  
  955. SYNOPSIS
  956.     char * DateToStr (int date)
  957. INPUTS
  958.     date    -   integer date value.
  959.  
  960. RETURN VALUE
  961.     String representation of an integer date value.
  962.  
  963. ALSO SEE
  964.     TimeToStr  USRludate SysDate  SysTime
  965.  
  966. EXAMPLE
  967.     main ()
  968.     {
  969.         int date;
  970.  
  971.         date = SysDate ();
  972.         printf ("Today's date: %s\n",DateToStr (date));
  973.     }
  974.  
  975. ----------------------------------------------------------------------
  976.  
  977. NAME
  978.     exit
  979.  
  980. DESCRIPTION
  981.     Exit the MUL script, return to the operating system.
  982.  
  983. SYNOPSIS
  984.     void exit (int return_value)
  985.  
  986. INPUTS
  987.     return_value    -   Value to return to the operating system.
  988.  
  989. RETURN VALUE
  990.     None
  991.  
  992. ALSO SEE
  993.     return
  994.  
  995. EXAMPLE
  996.     main ()
  997.     {
  998.         int i = 42;
  999.  
  1000.         printf ("Exiting to the operating system with a value of %d\n",i);
  1001.         exit (i);
  1002.     }
  1003.  
  1004. ----------------------------------------------------------------------
  1005.  
  1006. NAME
  1007.     fclose
  1008.  
  1009. DESCRIPTION
  1010.     Close a disk file.
  1011.  
  1012. SYNOPSIS
  1013.     int fclose (long file_handle)
  1014.  
  1015. INPUTS
  1016.     file_handle -   The file handle returned by fopen.
  1017.  
  1018. RETURN VALUE
  1019.     zero on success, TRUE on failure.
  1020.  
  1021. ALSO SEE
  1022.     fopen
  1023.  
  1024. EXAMPLE
  1025.     main ()
  1026.     {
  1027.         long fp;
  1028.  
  1029.         fp = fopen ("TEST.TMP","w");    // Open a disk file
  1030.         if (fp!=NULL) {
  1031.             // Write some text to the file
  1032.             fprintf (fp,"I'll buy that for a doller!\n");
  1033.             fclose (fp);                // Close the disk file
  1034.         }
  1035.     }
  1036.  
  1037. ----------------------------------------------------------------------
  1038.  
  1039. NAME
  1040.     feof
  1041.  
  1042. DESCRIPTION
  1043.     Returns end of file status.
  1044.  
  1045. SYNOPSIS
  1046.     int feof (long file_handle)
  1047.  
  1048. INPUTS
  1049.     file_handle -   The file handle returned by fopen.
  1050.  
  1051. RETURN VALUE
  1052.     TRUE for end of file reached, else zero.
  1053.  
  1054. ALSO SEE
  1055.     ferror  fopen fclose
  1056.  
  1057. EXAMPLE
  1058.     main ()
  1059.     {
  1060.         long fp;
  1061.         char line[132];
  1062.  
  1063.         fp = fopen ("MULFNREF.DOC","r"); // Open a disk file
  1064.         if (fp!=NULL) {
  1065.             while (!feof (fp)) {
  1066.                 // Read and display text line
  1067.                 if (fgets (line,132,fp)) puts (line);
  1068.             }
  1069.             fclose (fp);                 // Close the disk file
  1070.         }
  1071.     }
  1072.  
  1073. ----------------------------------------------------------------------
  1074.  
  1075. NAME
  1076.     ferror
  1077.  
  1078. DESCRIPTION
  1079.     Check for error on the given file.
  1080.  
  1081. SYNOPSIS
  1082.     int ferror (long file_handle)
  1083.  
  1084. INPUTS
  1085.     file_handle -   The file handle returned by fopen.
  1086.  
  1087. RETURN VALUE
  1088.     TRUE for an error condition, zero for no error.
  1089.  
  1090. ALSO SEE
  1091.     feof  fopen  fclose
  1092.  
  1093. EXAMPLE
  1094.     main ()
  1095.     {
  1096.         long fp;
  1097.         char line[132];
  1098.  
  1099.         fp = fopen ("MULFNREF.DOC","r"); // Open a disk file
  1100.         if (fp!=NULL) {
  1101.             // Read and display text lines
  1102.             while (!feof (fp)) if (fgets (line,132,fp)) puts (line);
  1103.  
  1104.             if (ferror (fp)) printf("File error encountered!\n");
  1105.             fclose (fp);                 // Close the disk file
  1106.         }
  1107.     }
  1108.  
  1109. ----------------------------------------------------------------------
  1110.  
  1111. NAME
  1112.     fgetc
  1113.  
  1114. DESCRIPTION
  1115.     Read a character from a file.
  1116.  
  1117. SYNOPSIS
  1118.     int fgetc (long file_handle)
  1119.  
  1120. INPUTS
  1121.     file_handle -   The file handle returned by fopen.
  1122.  
  1123. RETURN VALUE
  1124.     The character read, or -1 on error.
  1125.  
  1126. ALSO SEE
  1127.     fgets  fread  fopen  fclose
  1128.  
  1129. EXAMPLE
  1130.     main ()
  1131.     {
  1132.         long fp;
  1133.         char ch;
  1134.  
  1135.         fp = fopen ("MULFNREF.DOC","r"); // Open a disk file
  1136.         if (fp!=NULL) {
  1137.             while (!feof (fp)) {
  1138.                 ch = fgetc (fp);
  1139.                 if (ch != -1) putch (ch);
  1140.             }
  1141.             fclose (fp);                 // Close the disk file
  1142.         }
  1143.     }
  1144.  
  1145. ----------------------------------------------------------------------
  1146.  
  1147. NAME
  1148.     fgets
  1149.  
  1150. DESCRIPTION
  1151.     Reads up to number-1 characters from a file. Characters are read
  1152.     until either a newline or the end of file is received, or until
  1153.     the specified limit is reached.
  1154.  
  1155. SYNOPSIS
  1156.     char * fgets (char * str, int number, long file_handle)
  1157.  
  1158. INPUTS
  1159.     str         -   Character array received characters are placed into.
  1160.     number      -   Maximum number of characters to receive.
  1161.     file_handle -   The file handle returned by fopen.
  1162.  
  1163. RETURN VALUE
  1164.     str is returned on success, or NULL on failure.
  1165.  
  1166. ALSO SEE
  1167.     fgetc  fread  fopen  fclose
  1168.  
  1169. EXAMPLE
  1170.     main ()
  1171.     {
  1172.         long fp;
  1173.         char line[132];
  1174.  
  1175.         fp = fopen ("MULFNREF.DOC","r"); // Open a disk file
  1176.         if (fp!=NULL) {
  1177.             // Read and display text lines
  1178.             while (!feof (fp)) {
  1179.                 if (fgets (line,132,fp)) puts (line);
  1180.             }
  1181.             fclose (fp);                 // Close the disk file
  1182.         }
  1183.     }
  1184.  
  1185. ----------------------------------------------------------------------
  1186.  
  1187. NAME
  1188.     fopen
  1189.  
  1190. DESCRIPTION
  1191.     Open a disk file.
  1192.  
  1193. SYNOPSIS
  1194.     long fopen (char *fname, char *mode)
  1195.  
  1196. INPUTS
  1197.     fname       -   File path and name.
  1198.     mode        -   Access mode.
  1199.  
  1200.     Mode        Meaning
  1201.     "r"         Open text file for reading
  1202.     "w"         Create a text file for writing
  1203.     "a"         Append to text file
  1204.     "rb"        Open binary file for reading
  1205.     "wb"        Create binary file for writing
  1206.     "ab"        Append to a binary file
  1207.     "r+"        Open text file for read/write
  1208.     "w+"        Create text file for read/write
  1209.     "a+"        Open text file for read/write
  1210.     "r+b"       Open binary file for read/write
  1211.     "w+b"       Create binary file for read/write
  1212.     "a+b"       Open binary file for read/write
  1213.  
  1214. RETURN VALUE                                     
  1215.     The file handle, or NULL on failure.
  1216.  
  1217. ALSO SEE
  1218.     fclose
  1219.  
  1220. EXAMPLE
  1221.     main ()
  1222.     {
  1223.         long fp;
  1224.         char line[132];
  1225.  
  1226.         fp = fopen ("MULFNREF.DOC","r"); // Open a disk file
  1227.         if (fp!=NULL) {
  1228.             // Read and display text lines
  1229.             while (!feof (fp)) if (fgets (line,132,fp)) puts (line);
  1230.  
  1231.             fclose (fp);                 // Close the disk file
  1232.         }
  1233.     }
  1234.  
  1235. ----------------------------------------------------------------------
  1236.  
  1237. NAME
  1238.     fprintf
  1239.  
  1240. DESCRIPTION
  1241.     Formated print to file.
  1242.  
  1243. SYNOPSIS
  1244.     int fprintf (long file_handle, char *format_string, ... )
  1245.  
  1246. INPUTS
  1247.     file_handle     -   The file handle returned by fopen.
  1248.     format_string   -   Format character string.
  1249.     ...             -   Variable number of additional parameters.
  1250.  
  1251.     Format type         Meaning
  1252.     -----------         -------
  1253.     %d              -   display an integer as a signed decimal string
  1254.     %u              -   display an integer as an unsigned decimal string
  1255.     %x              -   display an integer as a hexidecimal string
  1256.     %o              -   display an integer as an octal string
  1257.     %b              -   display an integer as a binary string
  1258.     %c              -   display a character
  1259.     %s              -   display a character string
  1260.  
  1261.     Format modifiers
  1262.     ----------------
  1263.     -               -   left justify         e.g. %-10s
  1264.     digits          -   numeric field width. e.g. %10s
  1265.     l               -   long value.          e.g. %ld
  1266.  
  1267.     Note that all MUL function calls have a maximum parameter count
  1268.     of sixteen values.
  1269.  
  1270.     Escape sequences
  1271.     ----------------
  1272.     \n              -   newline character
  1273.     \t              -   tab character
  1274.     \f              -   formfeed character
  1275.     \a              -   bell character
  1276.     \b              -   backspace character
  1277.     \r              -   return character
  1278.     \0              -   null character
  1279.     \?              -   all other values print the literal character.
  1280.                         e.g. \"    \'    \\
  1281.  
  1282. RETURN VALUE
  1283.     Number of characters written.
  1284.  
  1285. ALSO SEE
  1286.     printf  sprintf
  1287.  
  1288. EXAMPLE
  1289.     main ()
  1290.     {
  1291.         int i = 42;
  1292.         long fp;
  1293.  
  1294.         fp = fopen ("TEST.TMP","w");     // Open a disk file
  1295.         if (fp==NULL) exit (1);          // If fopen failed, exit
  1296.  
  1297.         // Write to the file
  1298.         fprintf (fp,"The answer is %d\n",i);
  1299.  
  1300.         fclose (fp);                     // Close the disk file
  1301.     }
  1302.  
  1303. ----------------------------------------------------------------------
  1304.  
  1305. NAME
  1306.     fputc
  1307.  
  1308. DESCRIPTION
  1309.     Write the specified character to a file.
  1310.  
  1311. SYNOPSIS
  1312.     int fputc (int ch, long file_handle)
  1313.  
  1314. INPUTS
  1315.     ch          - The character to write.
  1316.     file_handle - The file handle returned by fopen.
  1317.  
  1318. RETURN VALUE
  1319.     The character written, or -1 on error.
  1320.  
  1321. ALSO SEE
  1322.     fputs  fwrite
  1323.  
  1324. EXAMPLE
  1325.     main ()
  1326.     {
  1327.         long fp;
  1328.  
  1329.         fp = fopen ("TEST.TMP","w");     // Open a disk file
  1330.         if (fp==NULL) exit (1);          // If fopen failed, exit
  1331.         fputc ('B',fp);                  // Write a character to the file
  1332.         fclose (fp);                     // Close the disk file
  1333.     }
  1334.  
  1335. ----------------------------------------------------------------------
  1336.  
  1337. NAME
  1338.     fputs
  1339.  
  1340. DESCRIPTION
  1341.     Write the specified character string to a file. The null terminator
  1342.     is not written.
  1343.  
  1344. SYNOPSIS
  1345.     int fputs (char * str, long file_handle)
  1346.  
  1347. INPUTS
  1348.     str         - The character string to write.
  1349.     file_handle - The file handle returned by fopen.
  1350.  
  1351. RETURN VALUE
  1352.     The last character written, or -1 on error.
  1353.  
  1354. ALSO SEE
  1355.     fputc  fwrite
  1356.  
  1357. EXAMPLE
  1358.     main ()
  1359.     {
  1360.         long fp;
  1361.  
  1362.         fp = fopen ("TEST.TMP","w");     // Open a disk file
  1363.         if (fp==NULL) exit (1);          // If fopen failed, exit
  1364.         fputs ("Blueberry Muffin",fp);   // Write the string to the file
  1365.         fclose (fp);                     // Close the disk file
  1366.     }
  1367.  
  1368. ----------------------------------------------------------------------
  1369.  
  1370. NAME
  1371.     fread
  1372.  
  1373. DESCRIPTION
  1374.     Read count number of objects from a file.
  1375.  
  1376. SYNOPSIS
  1377.     int fread (char * buf, int size, int count, long file_handle)
  1378.  
  1379. INPUTS
  1380.     buf         - Buffer to place the read data.
  1381.     size        - Size of each object.
  1382.     count       - Number of objects.
  1383.     file_handle - The file handle returned by fopen.
  1384.  
  1385. RETURN VALUE
  1386.     The number of items actually read.
  1387.  
  1388. ALSO SEE
  1389.     fgetc  fgets  fwrite
  1390.  
  1391. EXAMPLE
  1392.     main ()
  1393.     {
  1394.         long fp;
  1395.         int count;
  1396.         char buf[4096];
  1397.  
  1398.         fp = fopen ("MULFNREF.DOC","rb");  // Open a disk file for binary read
  1399.         if (fp==NULL) exit (1);            // If fopen failed, exit
  1400.  
  1401.         do {                               
  1402.             count = fread (buf,1,4096,fp); // Read a data block
  1403.  
  1404.             fwrite (buf,1,count,stdout);   // Display block to console
  1405.         } while (count);                   // While characters are read
  1406.  
  1407.         fclose (fp);                       // Close the disk file
  1408.     }
  1409.  
  1410. ----------------------------------------------------------------------
  1411.  
  1412. NAME
  1413.     free
  1414.  
  1415. DESCRIPTION
  1416.     Deallocate a memory block allocated with malloc.
  1417.  
  1418. SYNOPSIS
  1419.     void free (char *ptr)
  1420.  
  1421. INPUTS
  1422.     ptr     -   The pointer to the memory block.
  1423.  
  1424. RETURN VALUE
  1425.     None
  1426.  
  1427. ALSO SEE
  1428.     malloc
  1429.  
  1430. EXAMPLE
  1431.     main ()
  1432.     {
  1433.         char *ptr;                  // Declare a character pointer
  1434.  
  1435.         ptr = malloc (256);         // Allocate some storage
  1436.         if(ptr == NULL) exit ();    // Abort if allocation failed
  1437.  
  1438.         strcpy (ptr,"This Product Warps Space and Time in Its Vicinity.");
  1439.         printf ("%s\n",ptr);
  1440.  
  1441.         free (ptr);                 // Free the storage
  1442.     }
  1443.  
  1444. ----------------------------------------------------------------------
  1445.  
  1446. NAME
  1447.     fseek
  1448.  
  1449. DESCRIPTION
  1450.     Moved the file position indicator for a file.
  1451.  
  1452. SYNOPSIS
  1453.     int fseek (long file_handle, long offset, int origin)
  1454.  
  1455. INPUTS
  1456.     file_handle - The file handle returned by fopen.
  1457.     offset      - The number of bytes from origin to make the new position.
  1458.     origin      - 0 = file start, 1 = current position, or 2 = end of file.
  1459.  
  1460. RETURN VALUE
  1461.     Zero on success, non-zero on error.
  1462.  
  1463. ALSO SEE
  1464.     ftell  fread  fwrite
  1465.  
  1466. EXAMPLE
  1467.     main ()
  1468.     {
  1469.         long fp;
  1470.         int count;
  1471.         char buf[256];
  1472.  
  1473.         fp = fopen ("MULFNREF.DOC","rb");   // Open a disk file for binary read
  1474.         if (fp==NULL) exit (1);             // If fopen failed, exit
  1475.  
  1476.         fseek (fp,4096,0);                  // Move forward in the file
  1477.         count = fread (buf,1,256,fp);       // Read a data block
  1478.         fwrite (buf,1,count,stdout);        // Display block to console
  1479.         putch ('\n');                       // Display newline character
  1480.         fclose (fp);                        // Close the disk file
  1481.     }
  1482.  
  1483. ----------------------------------------------------------------------
  1484.  
  1485. NAME
  1486.     ftell
  1487.  
  1488. DESCRIPTION
  1489.     Return the current position of the file position indicator.
  1490.  
  1491. SYNOPSIS
  1492.     long ftell (long file_handle)
  1493.  
  1494. INPUTS
  1495.     file_handle - The file handle returned by fopen.
  1496.  
  1497. RETURN VALUE
  1498.     The current file position, or -1 on error.
  1499.  
  1500. ALSO SEE
  1501.     fseek
  1502.  
  1503. EXAMPLE
  1504.     main ()
  1505.     {
  1506.         long fp, pos;
  1507.  
  1508.         fp = fopen ("MULFNREF.DOC","rb");   // Open a disk file for binary read
  1509.         if (fp==NULL) exit (1);             // If fopen failed, exit
  1510.  
  1511.         fseek (fp,4096,0);                  // Move forward in the file
  1512.  
  1513.         pos = ftell (fp);
  1514.         printf ("File position: %ld\n",pos);
  1515.  
  1516.         fclose (fp);                        // Close the disk file
  1517.     }
  1518.  
  1519. ----------------------------------------------------------------------
  1520.  
  1521. NAME
  1522.     fwrite
  1523.  
  1524. DESCRIPTION
  1525.     Write count number of objects to a file.
  1526.  
  1527. SYNOPSIS
  1528.     int fwrite (char * buf, int size, int count, long file_handle)
  1529.  
  1530. INPUTS
  1531.     buf         - Buffer containing objects to write.
  1532.     size        - Size of each object.
  1533.     count       - Number of objects.
  1534.     file_handle - The file handle returned by fopen.
  1535.  
  1536. RETURN VALUE
  1537.     The number of items actually written.
  1538.  
  1539. ALSO SEE
  1540.     fread  fgetc  fgets
  1541.  
  1542. EXAMPLE
  1543.     main ()
  1544.     {
  1545.         long fp;
  1546.         char *buf = "Maximus-CBCS\r\n";
  1547.  
  1548.         fp = fopen ("TEST.TMP","wb");  // Open a disk file for binary write
  1549.         if (fp==NULL) exit (1);        // If fopen failed, exit
  1550.  
  1551.         fwrite (buf,14,1,fp);          // Write the data block
  1552.  
  1553.         fclose (fp);                   // Close the disk file
  1554.     }
  1555.  
  1556. ----------------------------------------------------------------------
  1557.  
  1558. NAME
  1559.     GenDate
  1560.  
  1561. DESCRIPTION
  1562.     Returns integer date version of date plus mths.
  1563.  
  1564. SYNOPSIS
  1565.     int GenDate (int date, int mths)
  1566.  
  1567. INPUTS
  1568.     date    -   Integer date, as returned by SysDate or USRludate.
  1569.     mths    -   Number of months for the addition.
  1570.  
  1571. RETURN VALUE
  1572.     Integer date.
  1573.  
  1574. ALSO SEE
  1575.     SysDate  DateToStr  GenTime
  1576.  
  1577. EXAMPLE
  1578.     main ()
  1579.     {
  1580.         int date, newdate, advance;
  1581.  
  1582.         advance = 6;
  1583.         date = SysDate ();  // Get the system date
  1584.  
  1585.         newdate = GenDate (date,advance);
  1586.  
  1587.         printf ("The date %d months from now: %s\n",
  1588.             advance,DateToStr (newdate));
  1589.     }
  1590.  
  1591. ----------------------------------------------------------------------
  1592.  
  1593. NAME
  1594.     GenTime
  1595.  
  1596. DESCRIPTION
  1597.     Returns integer time version of parameter time plus parameter mins.
  1598.  
  1599. SYNOPSIS
  1600.     int GenTime (int time, int mins)
  1601.  
  1602. INPUTS
  1603.     time    -   Integer time, as returned by SysTime or USRlutime.
  1604.     mins    -   Number of minutes for the addition.
  1605.  
  1606. RETURN VALUE
  1607.     Integer time.
  1608.  
  1609. ALSO SEE
  1610.     SysTime  TimeToStr  GenDate
  1611.  
  1612. EXAMPLE
  1613.     main ()
  1614.     {
  1615.         int time, newtime, advance;
  1616.  
  1617.         advance = 30;
  1618.         time = SysTime ();  // Get the system time
  1619.  
  1620.         newtime = GenTime (time,advance);
  1621.  
  1622.         printf ("The time %d minutes from now: %s\n",
  1623.             advance,TimeToStr (newtime));
  1624.     }
  1625.  
  1626. ----------------------------------------------------------------------
  1627.  
  1628. NAME
  1629.     getch
  1630.  
  1631. DESCRIPTION
  1632.     Get a character from the console, wait for character, no echo.
  1633.     Includes time slice release when operating under DESQview.
  1634.  
  1635. SYNOPSIS
  1636.     int getch (void)
  1637.  
  1638. INPUTS
  1639.     None
  1640.  
  1641. RETURN VALUE
  1642.     The console character.
  1643.  
  1644. ALSO SEE
  1645.     getche  getxch
  1646.  
  1647. EXAMPLE
  1648.     main ()
  1649.     {
  1650.         int ch;
  1651.  
  1652.         puts ("Hit a key.. ");      // Prompt
  1653.         ch = getch ();              // Get a character
  1654.  
  1655.         printf ("\nKey code %d was hit\n",ch);
  1656.     }
  1657.  
  1658. ----------------------------------------------------------------------
  1659.  
  1660. NAME
  1661.     getche
  1662.  
  1663. DESCRIPTION
  1664.     Get a character from the console, wait for character, with echo.
  1665.     Includes time slice release when operating under DESQview.
  1666.  
  1667. SYNOPSIS
  1668.     int getche (void)
  1669.  
  1670. INPUTS
  1671.     None
  1672.  
  1673. RETURN VALUE
  1674.     The console character.
  1675.  
  1676. ALSO SEE
  1677.     getch  getxch
  1678.  
  1679. EXAMPLE
  1680.     main ()
  1681.     {
  1682.         int ch;
  1683.  
  1684.         puts ("Hit a key.. ");      // Prompt
  1685.         ch = getche ();             // Get a character
  1686.  
  1687.         printf ("\nKey code %d was hit\n",ch);
  1688.     }
  1689.  
  1690. ----------------------------------------------------------------------
  1691.  
  1692. NAME
  1693.     getns
  1694.  
  1695. DESCRIPTION
  1696.     Read console string with maximum characters limit. Includes
  1697.     backspace support, return exits, ECS aborts. Includes time
  1698.     slice release when operating under DESQview.
  1699.  
  1700. SYNOPSIS
  1701.     int getns (char *str, int maxchars)
  1702.  
  1703. INPUTS
  1704.     str         - Buffer into which to place the received characters.
  1705.     maxchars    - Maximum characters limit.
  1706.  
  1707. RETURN VALUE
  1708.     Zero on success, non-zero if ESC pressed.
  1709.  
  1710. ALSO SEE
  1711.     getxch  getch
  1712.  
  1713. EXAMPLE
  1714.     main ()
  1715.     {
  1716.         char buf[40];
  1717.  
  1718.         puts ("Enter your name-------------------|\n");   // Prompt
  1719.         getns (buf,35);                                   // Get the string
  1720.  
  1721.         printf ("\n\nHi %s\n",buf);
  1722.     }
  1723.  
  1724. ----------------------------------------------------------------------
  1725.  
  1726. NAME
  1727.     getxch
  1728.  
  1729. DESCRIPTION
  1730.     Get an extended character code from the console, wait for character,
  1731.     no echo. Includes time slice release when operating under DESQview.
  1732.  
  1733. SYNOPSIS
  1734.     int getxch (void)
  1735.  
  1736. INPUTS
  1737.     None
  1738.  
  1739. RETURN VALUE
  1740.     The extended console character.
  1741.  
  1742. ALSO SEE
  1743.     getch  getche
  1744.  
  1745. EXAMPLE
  1746.     main ()
  1747.     {
  1748.         int ch;
  1749.  
  1750.         puts ("Hit a key.. ");      // Prompt
  1751.         ch = getxch ();             // Get a character
  1752.  
  1753.         printf ("\nKey code %4x was hit\n",ch);
  1754.     }
  1755.  
  1756. ----------------------------------------------------------------------
  1757.  
  1758. NAME
  1759.     Hidecur
  1760.  
  1761. DESCRIPTION
  1762.     Hide the console cursor.
  1763.  
  1764. SYNOPSIS
  1765.     void Hidecur (void)
  1766. INPUTS
  1767.     None
  1768.  
  1769. RETURN VALUE
  1770.     None
  1771.  
  1772. ALSO SEE
  1773.     Showcur
  1774.  
  1775. EXAMPLE
  1776.     main ()
  1777.     {
  1778.         Hidecur ();
  1779.  
  1780.         puts ("Cursor hidden, press as key.. ");
  1781.         getxch ();
  1782.  
  1783.         Showcur ();
  1784.  
  1785.         puts ("\nCursor restored.\n");
  1786.     }
  1787.  
  1788. ----------------------------------------------------------------------
  1789.  
  1790. NAME
  1791.     Invert
  1792.  
  1793. DESCRIPTION
  1794.     Bitwise inversion.
  1795.  
  1796. SYNOPSIS
  1797.     long Invert (long value)
  1798.  
  1799. INPUTS
  1800.     value   -   Value to invert.
  1801.  
  1802. RETURN VALUE
  1803.     Inverted value.
  1804.  
  1805. ALSO SEE
  1806.     And  Or  Xor
  1807.  
  1808. EXAMPLE
  1809.     main ()
  1810.     {
  1811.         int value = 42;
  1812.  
  1813.         printf ("Value in binary = %016b\n",value);
  1814.  
  1815.         value = Invert (value); // Invert the value
  1816.         printf ("Inverted value  = %016b\n",value);
  1817.     }
  1818.  
  1819. ----------------------------------------------------------------------
  1820.  
  1821. NAME
  1822.     isalnum
  1823.  
  1824. DESCRIPTION
  1825.     Tests if a character is either a letter of the alphabet or a digit.
  1826.  
  1827. SYNOPSIS
  1828.     int isalnum (int ch)
  1829.  
  1830. INPUTS
  1831.     ch  -   The character to test.
  1832.  
  1833. RETURN VALUE
  1834.     Non-zero on success, zero on failure.
  1835.  
  1836. ALSO SEE
  1837.     isalpha  isascii  iscntrl  isdigit  isgraph  islower  isprint
  1838.     ispunct  isspace  isupper  isxdigit
  1839.  
  1840. EXAMPLE
  1841.     main ()
  1842.     {
  1843.         char ch = 'A';
  1844.  
  1845.         if (isalnum (ch)) printf ("Character %c passed\n",ch);
  1846.         else              printf ("Character %c failed\n",ch);
  1847.     }
  1848.  
  1849. ----------------------------------------------------------------------
  1850.  
  1851. NAME
  1852.     isalpha
  1853.  
  1854. DESCRIPTION
  1855.     Tests if a character is a letter of the alphabet.
  1856.  
  1857. SYNOPSIS
  1858.     int isalpha (int ch)
  1859.  
  1860. INPUTS
  1861.     ch  -   The character to test.
  1862.  
  1863. RETURN VALUE
  1864.     Non-zero on success, zero on failure.
  1865.  
  1866. ALSO SEE
  1867.     isalnum  isascii  iscntrl  isdigit  isgraph  islower  isprint
  1868.     ispunct  isspace  isupper  isxdigit
  1869.  
  1870. EXAMPLE
  1871.     main ()
  1872.     {
  1873.         char ch = 'A';
  1874.  
  1875.         if (isalpha (ch)) printf ("Character %c passed\n",ch);
  1876.         else              printf ("Character %c failed\n",ch);
  1877.     }
  1878.  
  1879. ----------------------------------------------------------------------
  1880.  
  1881. NAME
  1882.     isascii
  1883.  
  1884. DESCRIPTION
  1885.     Tests if a character is an ascii character (less than or equal to 127).
  1886.  
  1887. SYNOPSIS
  1888.     int isascii (int ch)
  1889.  
  1890. INPUTS
  1891.     ch  -   The character to test.
  1892.  
  1893. RETURN VALUE
  1894.     Non-zero on success, zero on failure.
  1895.  
  1896. ALSO SEE
  1897.     isalnum  isalpha  iscntrl  isdigit  isgraph  islower  isprint
  1898.     ispunct  isspace  isupper  isxdigit
  1899.  
  1900. EXAMPLE
  1901.     main ()
  1902.     {
  1903.         char ch = 'A';
  1904.  
  1905.         if (isascii (ch)) printf ("Character %c passed\n",ch);
  1906.         else              printf ("Character %c failed\n",ch);
  1907.     }
  1908.  
  1909. ----------------------------------------------------------------------
  1910.  
  1911. NAME
  1912.     iscntrl
  1913.  
  1914. DESCRIPTION
  1915.     Tests if a character is a control character.
  1916.  
  1917. SYNOPSIS
  1918.     int iscntrl (int ch)
  1919.  
  1920. INPUTS
  1921.     ch  -   The character to test.
  1922.  
  1923. RETURN VALUE
  1924.     Non-zero on success, zero on failure.
  1925.  
  1926. ALSO SEE
  1927.     isalnum  isalpha  isascii  isdigit  isgraph  islower  isprint
  1928.     ispunct  isspace  isupper  isxdigit
  1929.  
  1930. EXAMPLE
  1931.     main ()
  1932.     {
  1933.         char ch = 'A';
  1934.  
  1935.         if (iscntrl (ch)) printf ("Character %c passed\n",ch);
  1936.         else              printf ("Character %c failed\n",ch);
  1937.     }
  1938.  
  1939. ----------------------------------------------------------------------
  1940.  
  1941. NAME
  1942.     isdigit
  1943.  
  1944. DESCRIPTION
  1945.     Tests if a character is a digit (0 - 9).
  1946.  
  1947. SYNOPSIS
  1948.     int isdigit (int ch)
  1949.  
  1950. INPUTS
  1951.     ch  -   The character to test.
  1952.  
  1953. RETURN VALUE
  1954.     Non-zero on success, zero on failure.
  1955.  
  1956. ALSO SEE
  1957.     isalnum  isalpha  isascii  iscntrl  isgraph  islower  isprint
  1958.     ispunct  isspace  isupper  isxdigit
  1959.  
  1960. EXAMPLE
  1961.     main ()
  1962.     {
  1963.         char ch = 'A';
  1964.  
  1965.         if (isdigit (ch)) printf ("Character %c passed\n",ch);
  1966.         else              printf ("Character %c failed\n",ch);
  1967.     }
  1968.  
  1969. ----------------------------------------------------------------------
  1970.  
  1971. NAME
  1972.     isgraph
  1973.  
  1974. DESCRIPTION
  1975.     Tests if a character is a printable character, other than a space.
  1976.  
  1977. SYNOPSIS
  1978.     int isgraph (int ch)
  1979.  
  1980. INPUTS
  1981.     ch  -   The character to test.
  1982.  
  1983. RETURN VALUE
  1984.     Non-zero on success, zero on failure.
  1985.  
  1986. ALSO SEE
  1987.     isalnum  isalpha  isascii  iscntrl  isdigit  islower  isprint
  1988.     ispunct  isspace  isupper  isxdigit
  1989.  
  1990. EXAMPLE
  1991.     main ()
  1992.     {
  1993.         char ch = 'A';
  1994.  
  1995.         if (isgraph (ch)) printf ("Character %c passed\n",ch);
  1996.         else              printf ("Character %c failed\n",ch);
  1997.     }
  1998.  
  1999. ----------------------------------------------------------------------
  2000.  
  2001. NAME
  2002.     islower
  2003.  
  2004. DESCRIPTION
  2005.     Tests if a character is a lower case letter.
  2006.  
  2007. SYNOPSIS
  2008.     int islower (int ch)
  2009.  
  2010. INPUTS
  2011.     ch  -   The character to test.
  2012.  
  2013. RETURN VALUE
  2014.     Non-zero on success, zero on failure.
  2015.  
  2016. ALSO SEE
  2017.     isalnum  isalpha  isascii  iscntrl  isdigit  isgraph  isprint
  2018.     ispunct  isspace  isupper  isxdigit
  2019.  
  2020. EXAMPLE
  2021.     main ()
  2022.     {
  2023.         char ch = 'A';
  2024.  
  2025.         if (islower (ch)) printf ("Character %c passed\n",ch);
  2026.         else              printf ("Character %c failed\n",ch);
  2027.     }
  2028.  
  2029. ----------------------------------------------------------------------
  2030.  
  2031. NAME
  2032.     isprint
  2033.  
  2034. DESCRIPTION
  2035.     Tests if a character is a printable character, including space.
  2036.  
  2037. SYNOPSIS
  2038.     int isprint (int ch)
  2039.  
  2040. INPUTS
  2041.     ch  -   The character to test.
  2042.  
  2043. RETURN VALUE
  2044.     Non-zero on success, zero on failure.
  2045.  
  2046. ALSO SEE
  2047.     isalnum  isalpha  isascii  iscntrl  isdigit  isgraph  islower
  2048.     ispunct  isspace  isupper  isxdigit
  2049.  
  2050. EXAMPLE
  2051.     main ()
  2052.     {
  2053.         char ch = 'A';
  2054.  
  2055.         if (isprint (ch)) printf ("Character %c passed\n",ch);
  2056.         else              printf ("Character %c failed\n",ch);
  2057.     }
  2058.  
  2059. ----------------------------------------------------------------------
  2060.  
  2061. NAME
  2062.     ispunct
  2063.  
  2064. DESCRIPTION
  2065.     Tests if a character is a punctuation character, excluding space.
  2066.  
  2067. SYNOPSIS
  2068.     int ispunct (int ch)
  2069.  
  2070. INPUTS
  2071.     ch  -   The character to test.
  2072.  
  2073. RETURN VALUE
  2074.     Non-zero on success, zero on failure.
  2075.  
  2076. ALSO SEE
  2077.     isalnum  isalpha  isascii  iscntrl  isdigit  isgraph  islower
  2078.     isprint  isspace  isupper  isxdigit
  2079.  
  2080. EXAMPLE
  2081.     main ()
  2082.     {
  2083.         char ch = 'A';
  2084.  
  2085.         if (ispunct (ch)) printf ("Character %c passed\n",ch);
  2086.         else              printf ("Character %c failed\n",ch);
  2087.     }
  2088.  
  2089. ----------------------------------------------------------------------
  2090.  
  2091. NAME
  2092.     isspace
  2093.  
  2094. DESCRIPTION
  2095.     Tests if a character is a tab, newline, or space.
  2096.  
  2097. SYNOPSIS
  2098.     int isspace (int ch)
  2099.  
  2100. INPUTS
  2101.     ch  -   The character to test.
  2102.  
  2103. RETURN VALUE
  2104.     Non-zero on success, zero on failure.
  2105.  
  2106. ALSO SEE
  2107.     isalnum  isalpha  isascii  iscntrl  isdigit  isgraph  islower
  2108.     isprint  ispunct  isupper  isxdigit
  2109.  
  2110. EXAMPLE
  2111.     main ()
  2112.     {
  2113.         char ch = 'A';
  2114.  
  2115.         if (isspace (ch)) printf ("Character %c passed\n",ch);
  2116.         else              printf ("Character %c failed\n",ch);
  2117.     }
  2118.  
  2119. ----------------------------------------------------------------------
  2120.  
  2121. NAME
  2122.     isupper
  2123.  
  2124. DESCRIPTION
  2125.     Tests if a character is an upper case letter.
  2126.  
  2127. SYNOPSIS
  2128.     int isupper (int ch)
  2129.  
  2130. INPUTS
  2131.     ch  -   The character to test.
  2132.  
  2133. RETURN VALUE
  2134.     Non-zero on success, zero on failure.
  2135.  
  2136. ALSO SEE
  2137.     isalnum  isalpha  isascii  iscntrl  isdigit  isgraph  islower
  2138.     isprint  ispunct  isspace  isxdigit
  2139.  
  2140. EXAMPLE
  2141.     main ()
  2142.     {
  2143.         char ch = 'A';
  2144.  
  2145.         if (isupper (ch)) printf ("Character %c passed\n",ch);
  2146.         else              printf ("Character %c failed\n",ch);
  2147.     }
  2148.  
  2149. ----------------------------------------------------------------------
  2150.  
  2151. NAME
  2152.     isxdigit
  2153.  
  2154. DESCRIPTION
  2155.     Tests if a character is a hexadecimal digit (0 - 9, A - F, or a - f).
  2156.  
  2157. SYNOPSIS
  2158.     int isxdigit (int ch)
  2159.  
  2160. INPUTS
  2161.     ch  -   The character to test.
  2162.  
  2163. RETURN VALUE
  2164.     Non-zero on success, zero on failure.
  2165.  
  2166. ALSO SEE
  2167.     isalnum  isalpha  isascii  iscntrl  isdigit  isgraph  islower
  2168.     isprint  ispunct  isspace  isupper
  2169.  
  2170. EXAMPLE
  2171.     main ()
  2172.     {
  2173.         char ch = 'A';
  2174.  
  2175.         if (isxdigit (ch)) printf ("Character %c passed\n",ch);
  2176.         else               printf ("Character %c failed\n",ch);
  2177.     }
  2178.  
  2179. ----------------------------------------------------------------------
  2180.  
  2181. NAME
  2182.     itoa
  2183.  
  2184. DESCRIPTION
  2185.     Convert an integer to a string.
  2186.  
  2187. SYNOPSIS
  2188.     char * itoa (int num, char *buf, int radix)
  2189.  
  2190. INPUTS
  2191.     num     -   Integer to convert.
  2192.     buf     -   Buffer into which to place the output string.
  2193.     radix   -   The base of the output string, range 2 to 36.
  2194.  
  2195. RETURN VALUE
  2196.     The output string.
  2197.  
  2198. ALSO SEE
  2199.     ltoa  atoi
  2200.  
  2201. EXAMPLE
  2202.     main ()
  2203.     {
  2204.         int i = 42;
  2205.         char buf[20];
  2206.  
  2207.         itoa (i,buf,10);    // Convert to a base 10 string.
  2208.  
  2209.         printf ("And the answer is: %s\n",buf);
  2210.     }
  2211.  
  2212. ----------------------------------------------------------------------
  2213.  
  2214. NAME
  2215.     kbhit
  2216.  
  2217. DESCRIPTION
  2218.     Console key hit status.
  2219.  
  2220. SYNOPSIS
  2221.     int kbhit (void)
  2222.  
  2223. INPUTS
  2224.     None
  2225.  
  2226. RETURN VALUE
  2227.     Non-zero if a key press is waiting, else zero.
  2228.  
  2229. ALSO SEE
  2230.     getch  getche  getxch
  2231.  
  2232. EXAMPLE
  2233.     main ()
  2234.     {
  2235.         printf ("Hit any key to exit .. ");
  2236.  
  2237.         while (!kbhit ()) ;     // Wait for a key press
  2238.         getxch ();              // Get the key
  2239.         putch ('\n');           // Display newline character
  2240.     }
  2241.  
  2242. ----------------------------------------------------------------------
  2243.  
  2244. NAME
  2245.     ltoa
  2246.  
  2247. DESCRIPTION
  2248.     Convert a long to a string.
  2249.  
  2250. SYNOPSIS
  2251.     char * ltoa (long num, char *buf, int radix)
  2252.  
  2253. INPUTS
  2254.     num     -   Long value to convert.
  2255.     buf     -   Buffer into which to place the output string.
  2256.     radix   -   The base of the output string, range 2 to 36.
  2257.  
  2258. RETURN VALUE
  2259.     The output string.
  2260.  
  2261. ALSO SEE
  2262.     itoa  atol
  2263.  
  2264. EXAMPLE
  2265.     main ()
  2266.     {
  2267.         long var = 42;
  2268.         char buf[20];
  2269.  
  2270.         ltoa (var,buf,10);    // Convert to a base 10 string.
  2271.  
  2272.         printf ("And the answer is: %s\n",buf);
  2273.     }
  2274.  
  2275. ----------------------------------------------------------------------
  2276.  
  2277. NAME
  2278.     malloc
  2279.  
  2280. DESCRIPTION
  2281.     Allocate a memory block.
  2282.  
  2283. SYNOPSIS
  2284.     char * malloc (int size)
  2285.  
  2286. INPUTS
  2287.     size    -   The size of the memory bloac to allocate in bytes.
  2288.  
  2289. RETURN VALUE
  2290.     The address of the memory block, or NULL on error.
  2291.  
  2292. ALSO SEE
  2293.     free
  2294.  
  2295. EXAMPLE
  2296.     main ()
  2297.     {
  2298.         char *ptr;                  // Declare a character pointer
  2299.  
  2300.         ptr = malloc (256);         // Allocate some storage
  2301.         if(ptr == NULL) exit ();    // Abort if allocation failed
  2302.  
  2303.         strcpy (ptr,"This Product Warps Space and Time in Its Vicinity.");
  2304.         printf ("%s\n",ptr);
  2305.  
  2306.         free (ptr);                 // Free the storage
  2307.     }
  2308.  
  2309. ----------------------------------------------------------------------
  2310.  
  2311. NAME
  2312.     NumCols
  2313.  
  2314. DESCRIPTION
  2315.     Returns the number of display columns on the system console.
  2316.  
  2317. SYNOPSIS
  2318.     int NumCols (void)
  2319.  
  2320. INPUTS
  2321.     None
  2322.  
  2323. RETURN VALUE
  2324.     The width of the video display.
  2325.  
  2326. ALSO SEE
  2327.     NumRows
  2328.  
  2329. EXAMPLE
  2330.     main ()
  2331.     {
  2332.         printf ("Video screen is currently %d x %d\n",NumRows (),NumCols ());
  2333.     }
  2334.  
  2335. ----------------------------------------------------------------------
  2336.  
  2337. NAME
  2338.     NumRows
  2339.  
  2340. DESCRIPTION
  2341.     Returns the number of display rows on the system console.
  2342.  
  2343. SYNOPSIS
  2344.     int NumRows (void)
  2345.  
  2346. INPUTS
  2347.     None
  2348.  
  2349. RETURN VALUE
  2350.     The height of the video display.
  2351.  
  2352. ALSO SEE
  2353.     NumCols
  2354.  
  2355. EXAMPLE
  2356.     main ()
  2357.     {
  2358.         printf ("Video screen is currently %d x %d\n",NumRows (),NumCols ());
  2359.     }
  2360.  
  2361. ----------------------------------------------------------------------
  2362.  
  2363. NAME
  2364.     Or
  2365.  
  2366. DESCRIPTION
  2367.     Returns the bitwise OR of the two arguments. At the bit level,
  2368.     that is for each bit in the two arguments, a bitwise OR results
  2369.     in "only two zero's make a zero".
  2370.  
  2371. SYNOPSIS
  2372.     long Or (long arg1, long arg2)
  2373.  
  2374. INPUTS
  2375.     arg1        -   First value.
  2376.     arg2        -   Second value.
  2377.  
  2378. RETURN VALUE
  2379.     Value of the bitwise OR.
  2380.  
  2381. ALSO SEE
  2382.     And  Xor  Invert  ShiftLeft  ShiftRight
  2383.  
  2384. EXAMPLE
  2385.     main ()
  2386.     {
  2387.         int val = 0;
  2388.  
  2389.         val = Or (val,0x80);       // Turn on bit seven
  2390.  
  2391.         printf ("val = %u\n",val);
  2392.     }
  2393.  
  2394. ----------------------------------------------------------------------
  2395.  
  2396. NAME
  2397.     Pause
  2398.  
  2399. DESCRIPTION
  2400.     Suspends execution for specified duration in timerticks. The usual
  2401.     system timer tick rate is 18.2 ticks per second. Includes time slice
  2402.     release when operating under DESQview.
  2403.  
  2404. SYNOPSIS
  2405.     void Pause (int ticks)
  2406.  
  2407. INPUTS
  2408.     ticks   -   Pause duration in timer ticks.
  2409.  
  2410. RETURN VALUE
  2411.     None
  2412.  
  2413. ALSO SEE
  2414.     Play
  2415.  
  2416. EXAMPLE
  2417.     main ()
  2418.     {
  2419.         printf ("Pausing for a second\n");
  2420.         Pause (18);
  2421.     }
  2422.  
  2423. ----------------------------------------------------------------------
  2424.  
  2425. NAME
  2426.     Play
  2427.  
  2428. DESCRIPTION
  2429.     Plays a tone for a specified frequency and duration. A frequency of
  2430.     zero produces no sound for the duration.
  2431.  
  2432. SYNOPSIS
  2433.     void Play (int hertz, int hsec)
  2434.  
  2435. INPUTS
  2436.     hertz   -   Note frequency.
  2437.     hsec    -   Note duration.
  2438.  
  2439. RETURN VALUE
  2440.     None
  2441.  
  2442. ALSO SEE
  2443.     Pause
  2444.  
  2445. EXAMPLE
  2446.     main ()
  2447.     {
  2448.         // Play the theme From "The Pink Panther"
  2449.         Play (271,160);  Play (287,330);  Play (304,160);  Play (322,830);
  2450.         Play (  0, 50);  Play (362,160);  Play (383,830);  Play (  0, 50);
  2451.         Play (304,160);  Play (322,330);  Play (362,160);  Play (383,330);
  2452.         Play (512,160);  Play (483,330);  Play (322,160);  Play (383,270);
  2453.         Play (483,200);  Play (456, 60);  Play (512, 60);  Play (456, 60);
  2454.         Play (512, 60);  Play (456, 60);  Play (512, 60);  Play (456, 60);
  2455.         Play (512, 60);  Play (456, 60);  Play (512, 60);  Play (456,570);
  2456.         Play (430,140);  Play (383,140);  Play (322,140);  Play (287,140);
  2457.         Play (322,770);
  2458.     }
  2459.  
  2460. ----------------------------------------------------------------------
  2461.  
  2462. NAME
  2463.     printf
  2464.  
  2465. DESCRIPTION
  2466.     Formated print to the console.
  2467.  
  2468. SYNOPSIS
  2469.     int printf (char *format_string, ... )
  2470.  
  2471. INPUTS
  2472.     format_string   -   Format character string.
  2473.     ...             -   Variable number of additional parameters.
  2474.  
  2475.     Format type         Meaning
  2476.     -----------         -------
  2477.     %d              -   display an integer as a signed decimal string
  2478.     %u              -   display an integer as an unsigned decimal string
  2479.     %x              -   display an integer as a hexidecimal string
  2480.     %o              -   display an integer as an octal string
  2481.     %b              -   display an integer as a binary string
  2482.     %c              -   display a character
  2483.     %s              -   display a character string
  2484.  
  2485.     Format modifiers
  2486.     ----------------
  2487.     -               -   left justify         e.g. %-10s
  2488.     digits          -   numeric field width. e.g. %10s
  2489.     l               -   long value.          e.g. %ld
  2490.  
  2491.     Note that all MUL function calls have a maximum parameter count
  2492.     of sixteen values.
  2493.  
  2494.     Escape sequences
  2495.     ----------------
  2496.     \n              -   newline character
  2497.     \t              -   tab character
  2498.     \f              -   formfeed character
  2499.     \a              -   bell character
  2500.     \b              -   backspace character
  2501.     \r              -   return character
  2502.     \0              -   null character
  2503.     \?              -   all other values print the literal character.
  2504.                         e.g. \"    \'    \\
  2505.  
  2506. RETURN VALUE
  2507.     Number of characters written.
  2508.  
  2509. ALSO SEE
  2510.     fprintf  sprintf
  2511.  
  2512. EXAMPLE
  2513.     main ()
  2514.     {
  2515.         int i = 42;
  2516.         printf ("The answer is %d\n",i);
  2517.     }
  2518.  
  2519. ----------------------------------------------------------------------
  2520.  
  2521. NAME
  2522.     putch
  2523.  
  2524. DESCRIPTION
  2525.     Write a character to the console.
  2526.  
  2527. SYNOPSIS
  2528.     int putch (char ch)
  2529.  
  2530. INPUTS
  2531.     ch  -   The character to write.
  2532.  
  2533. RETURN VALUE
  2534.     The character written, or -1 on error.
  2535.  
  2536. ALSO SEE
  2537.     puts  printf  getch
  2538.  
  2539. EXAMPLE
  2540.     main ()
  2541.     {
  2542.         putch ('M'); putch ('U');  putch ('L');
  2543.         putch ('\n');
  2544.     }
  2545.  
  2546. ----------------------------------------------------------------------
  2547.  
  2548. NAME
  2549.     puts
  2550.  
  2551. DESCRIPTION
  2552.     Write a character string to the console. The null terminator is not
  2553.     written. A slight difference from the standard C language puts
  2554.     function is that a newline character is NOT appended to the output.
  2555.  
  2556. SYNOPSIS
  2557.     int puts (char * str)
  2558.  
  2559. INPUTS
  2560.     str     -   The character string to write.
  2561.  
  2562. RETURN VALUE
  2563.     The last character written, or -1 on error.
  2564.  
  2565. ALSO SEE
  2566.     putch  printf  getns
  2567.  
  2568. EXAMPLE
  2569.     main ()
  2570.     {
  2571.         puts ("MUL\n");     // Display a string with a newline.
  2572.     }
  2573.  
  2574. ----------------------------------------------------------------------
  2575.  
  2576. NAME
  2577.     rand
  2578.  
  2579. DESCRIPTION
  2580.     Return a pseudo-random number. Range is from 0 to 32767 inclusive.
  2581.  
  2582. SYNOPSIS
  2583.     int rand (void)
  2584.  
  2585. INPUTS
  2586.     None
  2587.  
  2588. RETURN VALUE
  2589.     The random number.
  2590.  
  2591. ALSO SEE
  2592.     srand
  2593.  
  2594. EXAMPLE
  2595.     main ()
  2596.     {
  2597.         int r;
  2598.  
  2599.         srand (SysTime ());                 // Setup the random generator
  2600.  
  2601.         // Generate a random number between 1 and 10 inclusive
  2602.         r = rand () % 10 + 1;               
  2603.  
  2604.         printf ("Today's number is the number %d\n",r);
  2605.     }
  2606.  
  2607. ----------------------------------------------------------------------
  2608.  
  2609. NAME
  2610.     remove
  2611.  
  2612. DESCRIPTION
  2613.     Delete a disk file.
  2614.  
  2615. SYNOPSIS
  2616.     int remove (char *fname)
  2617.  
  2618. INPUTS
  2619.     fname   -   The file path and name to delete.
  2620.  
  2621. RETURN VALUE
  2622.     Zero on success, -1 on failure.
  2623.  
  2624. ALSO SEE
  2625.     rename
  2626.  
  2627. EXAMPLE
  2628.     main ()
  2629.     {
  2630.         long fp;
  2631.         char * fname = "DEL_ME.TMP";
  2632.  
  2633.         // Create a file to delete
  2634.         fp = fopen (fname,"wb");        // Open temporary file
  2635.         if (fp == NULL) exit (1);       // Abort if fopen failed
  2636.         fclose (fp);                    // Close the file
  2637.  
  2638.         remove (fname);                 // Delete the temporary file
  2639.     }
  2640.  
  2641. ----------------------------------------------------------------------
  2642.  
  2643. NAME
  2644.     rename
  2645.  
  2646. DESCRIPTION
  2647.     Rename a disk file.
  2648.  
  2649. SYNOPSIS
  2650.     int rename (char * oldfname, char * newfname)
  2651.  
  2652. INPUTS
  2653.     oldfname    -   Existing file name.
  2654.     newfname    -   New name for the file.
  2655.  
  2656. RETURN VALUE
  2657.     Zero on success, -1 on failure.
  2658.  
  2659. ALSO SEE
  2660.     remove
  2661.  
  2662. EXAMPLE
  2663.     main ()
  2664.     {
  2665.         long fp;
  2666.         char * fname = "DEL_ME.TMP";
  2667.  
  2668.         // Create a file to rename
  2669.         fp = fopen (fname,"wb");        // Open temporary file
  2670.         if (fp == NULL) exit (1);       // Abort if fopen failed
  2671.         fclose (fp);                    // Close the file
  2672.  
  2673.         rename (fname,"RENAMED.TMP");   // Rename the temporary file
  2674.     }
  2675.  
  2676. ----------------------------------------------------------------------
  2677.  
  2678. NAME
  2679.     reverse
  2680.  
  2681. DESCRIPTION
  2682.     Reverse a character string in place.
  2683.  
  2684. SYNOPSIS
  2685.     void reverse (char * str)
  2686.  
  2687. INPUTS
  2688.     str     -   The string to reverse.
  2689.  
  2690. RETURN VALUE
  2691.     None
  2692.  
  2693. ALSO SEE
  2694.     strcat  strcpy  strdup  strlen
  2695.  
  2696. EXAMPLE
  2697.     main ()
  2698.     {
  2699.         long fp;
  2700.         char * str = "egaugnaL resU sumixaM ehT";
  2701.  
  2702.         reverse (str);
  2703.         printf("%s\n",str);
  2704.     }
  2705.  
  2706. ----------------------------------------------------------------------
  2707.  
  2708. NAME
  2709.     rewind
  2710.  
  2711. DESCRIPTION
  2712.     Move the file position indicator to the beginning of the file.
  2713.  
  2714. SYNOPSIS
  2715.     void rewind (long file_handle)
  2716.  
  2717. INPUTS
  2718.     file_handle -   The file handle returned by fopen.
  2719.  
  2720. RETURN VALUE
  2721.     None
  2722.  
  2723. ALSO SEE
  2724.     fseek
  2725.  
  2726. EXAMPLE
  2727.     main ()
  2728.     {
  2729.         long fp;
  2730.         char buf[256];
  2731.  
  2732.         fp=fopen ("MULFNREF.DOC","rb"); // Open a file
  2733.         if (fp == NULL) exit (1);       // Abort if fopen failed
  2734.         fread (buf,1,256,fp);           // Read some data
  2735.  
  2736.         rewind (fp);                    // Return to file start
  2737.  
  2738.         fread (buf,1,256,fp);           // Read some more data
  2739.         fwrite (buf,1,256,stdout);      // Write the data to the console
  2740.         putch ('\n');                   // Write a newline to the console
  2741.         fclose (fp);                    // Close the file
  2742.     }
  2743.  
  2744. ----------------------------------------------------------------------
  2745.  
  2746. NAME
  2747.     ShiftLeft
  2748.  
  2749. DESCRIPTION
  2750.     Returns the value bitwise shifted left count number of bits.
  2751.  
  2752. SYNOPSIS
  2753.     long ShiftLeft (long value, int count)
  2754.  
  2755. INPUTS
  2756.     value   -   The value to shift left.
  2757.     count   -   The number of shifts to perform.
  2758.  
  2759. RETURN VALUE
  2760.     The shifted value.
  2761.  
  2762. ALSO SEE
  2763.     ShiftRight
  2764.  
  2765. EXAMPLE
  2766.     main ()
  2767.     {
  2768.         int val = 1;
  2769.  
  2770.         val = ShiftLeft (val,4);       // Shift left 4 bits
  2771.  
  2772.         printf ("val = %u\n",val);
  2773.     }
  2774.  
  2775. ----------------------------------------------------------------------
  2776.  
  2777. NAME
  2778.     ShiftRight
  2779.  
  2780. DESCRIPTION
  2781.     Returns the value bitwise shifted right count number of bits.
  2782.  
  2783. SYNOPSIS
  2784.     long ShiftRight (long value, int count)
  2785.  
  2786. INPUTS
  2787.     value   -   The value to shift right.
  2788.     count   -   The number of shifts to perform.
  2789.  
  2790. RETURN VALUE
  2791.     The shifted value.
  2792.  
  2793. ALSO SEE
  2794.     ShiftLeft
  2795.  
  2796. EXAMPLE
  2797.     main ()
  2798.     {
  2799.         int val = 256;
  2800.  
  2801.         val = ShiftRight (val,1);       // Shift right 1 bit
  2802.  
  2803.         printf ("val = %u\n",val);
  2804.     }
  2805.  
  2806. ----------------------------------------------------------------------
  2807.  
  2808. NAME
  2809.     Showcur
  2810.  
  2811. DESCRIPTION
  2812.     Show the console cursor.
  2813.  
  2814. SYNOPSIS
  2815.     void Showcur (void)
  2816.  
  2817. INPUTS
  2818.     None
  2819.  
  2820. RETURN VALUE
  2821.     None
  2822.  
  2823. ALSO SEE
  2824.     Hidecur
  2825.  
  2826. EXAMPLE
  2827.     main ()
  2828.     {
  2829.         Hidecur ();
  2830.  
  2831.         puts ("Cursor hidden, press as key.. ");
  2832.         getxch ();
  2833.  
  2834.         Showcur ();
  2835.  
  2836.         puts ("\nCursor restored.\n");
  2837.     }
  2838.  
  2839. ----------------------------------------------------------------------
  2840.  
  2841. NAME
  2842.     sprintf
  2843.  
  2844. DESCRIPTION
  2845.     Formated print to a character string.
  2846.  
  2847. SYNOPSIS
  2848.     int sprintf (char *str, char *format_string, ... )
  2849.  
  2850. INPUTS
  2851.     str             -   The character string to print to.
  2852.     format_string   -   Format character string.
  2853.     ...             -   Variable number of additional parameters.
  2854.  
  2855.     Format type         Meaning
  2856.     -----------         -------
  2857.     %d              -   display an integer as a signed decimal string
  2858.     %u              -   display an integer as an unsigned decimal string
  2859.     %x              -   display an integer as a hexidecimal string
  2860.     %o              -   display an integer as an octal string
  2861.     %b              -   display an integer as a binary string
  2862.     %c              -   display a character
  2863.     %s              -   display a character string
  2864.  
  2865.     Format modifiers
  2866.     ----------------
  2867.     -               -   left justify         e.g. %-10s
  2868.     digits          -   numeric field width. e.g. %10s
  2869.     l               -   long value.          e.g. %ld
  2870.  
  2871.     Note that all MUL function calls have a maximum parameter count
  2872.     of sixteen values.
  2873.  
  2874.     Escape sequences
  2875.     ----------------
  2876.     \n              -   newline character
  2877.     \t              -   tab character
  2878.     \f              -   formfeed character
  2879.     \a              -   bell character
  2880.     \b              -   backspace character
  2881.     \r              -   return character
  2882.     \0              -   null character
  2883.     \?              -   all other values print the literal character.
  2884.                         e.g. \"    \'    \\
  2885.  
  2886. RETURN VALUE
  2887.     Number of characters written.
  2888.  
  2889. ALSO SEE
  2890.     fprintf  printf
  2891.  
  2892. EXAMPLE
  2893.     main ()
  2894.     {
  2895.         int i = 42;
  2896.         char buf[64];
  2897.  
  2898.         sprintf (buf,"The answer is %d\n",i);
  2899.         puts (buf);
  2900.     }
  2901.  
  2902. ----------------------------------------------------------------------
  2903.  
  2904. NAME
  2905.     srand
  2906.  
  2907. DESCRIPTION
  2908.     Set a starting point for the random number generator.
  2909.  
  2910. SYNOPSIS
  2911.     void srand (int seed)
  2912.  
  2913. INPUTS
  2914.     seed    -   The staring value.
  2915.  
  2916. RETURN VALUE
  2917.     None
  2918.  
  2919. ALSO SEE
  2920.     rand
  2921.  
  2922. EXAMPLE
  2923.     main ()
  2924.     {
  2925.         int r;
  2926.  
  2927.         srand (SysTime ());                 // Setup the random generator
  2928.  
  2929.         // Generate a random number between 1 and 10 inclusive
  2930.         r = rand () % 10 + 1;               
  2931.  
  2932.         printf ("Today's number is the number %d\n",r);
  2933.     }
  2934.  
  2935. ----------------------------------------------------------------------
  2936.  
  2937. NAME
  2938.     strcat
  2939.  
  2940. DESCRIPTION
  2941.     Concatenates a copy of str2 to str1 and terminates str1.
  2942.  
  2943. SYNOPSIS
  2944.     char * strcat (char * str1, char * str2)
  2945.  
  2946. INPUTS
  2947.     str1    -   The string to append to.
  2948.     str2    -   The string to append.
  2949.  
  2950. RETURN VALUE
  2951.     str1
  2952.  
  2953. ALSO SEE
  2954.     strncat
  2955.  
  2956. EXAMPLE
  2957.     main ()
  2958.     {
  2959.         char str1[80], str2[80];
  2960.  
  2961.         strcpy (str1,"This is a ");
  2962.         strcpy (str2,"sentance.\n");
  2963.  
  2964.         strcat (str1,str2);
  2965.  
  2966.         printf ("%s",str1);
  2967.     }
  2968.  
  2969. ----------------------------------------------------------------------
  2970.  
  2971. NAME
  2972.     strchr
  2973.  
  2974. DESCRIPTION
  2975.     Returns the first occurance of ch in string str, NULL if not found.
  2976.  
  2977. SYNOPSIS
  2978.     char * strchr (char * str, int ch)
  2979.  
  2980. INPUTS
  2981.     str     -   The string to search.
  2982.     ch      -   The character to search for.
  2983.  
  2984. RETURN VALUE
  2985.     Pointer to the found character, or NULL if not found.
  2986.  
  2987. ALSO SEE
  2988.     strrchr  strstr
  2989.  
  2990. EXAMPLE
  2991.     main ()
  2992.     {
  2993.         char *p, str[80];
  2994.  
  2995.         strcpy (str,"This is a sentance.\n");
  2996.  
  2997.         p = strchr (str,'a');
  2998.  
  2999.         if (p) printf ("%s",p);
  3000.         else printf ("Character not found\n");
  3001.     }
  3002.  
  3003. ----------------------------------------------------------------------
  3004.  
  3005. NAME
  3006.     strcmp
  3007.  
  3008. DESCRIPTION
  3009.     Lexicographically compares two null terminated strings and returns
  3010.     an integer based on the outcome.
  3011.  
  3012. SYNOPSIS
  3013.     int strcmp (char * str1, char * str2)
  3014.  
  3015. INPUTS
  3016.     str1    -   The first string to compare.
  3017.     str2    -   The second string to compare.
  3018.  
  3019. RETURN VALUE
  3020.     Less than 0     -   str1 is less than str2.
  3021.     0               -   str1 equals str2.
  3022.     Greater than 0  -   str1 is greater than str2.
  3023.  
  3024. ALSO SEE
  3025.     strncmp
  3026.  
  3027. EXAMPLE
  3028.     main ()
  3029.     {
  3030.         int result;
  3031.         char str1[80], str2[80];
  3032.  
  3033.         strcpy (str1,"Green"); strcpy (str2,"Peace");
  3034.  
  3035.         result = strcmp (str1,str2);
  3036.  
  3037.         if (result) {
  3038.             if (result>0) printf ("str1 is greater than str2\n");
  3039.             else printf ("str1 is less than str2\n");
  3040.         }
  3041.         else printf ("str1 equals str2\n");
  3042.     }
  3043.  
  3044. ----------------------------------------------------------------------
  3045.  
  3046. NAME
  3047.     strcpy
  3048.  
  3049. DESCRIPTION
  3050.     Copies the contents of a null terminated string into a string.
  3051.  
  3052. SYNOPSIS
  3053.     char * strcpy (char * str1, char * str2)
  3054.  
  3055. INPUTS
  3056.     str1    -   The destination string.
  3057.     str2    -   The string to be copied.
  3058.  
  3059. RETURN VALUE
  3060.     str1
  3061.  
  3062. ALSO SEE
  3063.     strncpy
  3064.  
  3065. EXAMPLE
  3066.     main ()
  3067.     {
  3068.         int result;
  3069.         char str1[80], str2[80];
  3070.  
  3071.         strcpy (str1,"Difficult is relative");
  3072.  
  3073.         strcpy (str2,str1);
  3074.  
  3075.         printf ("%s\n",str2);
  3076.     }
  3077.  
  3078. ----------------------------------------------------------------------
  3079.  
  3080. NAME
  3081.     strdup
  3082.  
  3083. DESCRIPTION
  3084.     Returns a pointer to a duplicate of a string.
  3085.  
  3086. SYNOPSIS
  3087.     char * strdup (char * str)
  3088.  
  3089. INPUTS
  3090.     str     -   The string to duplicate.
  3091.  
  3092. RETURN VALUE
  3093.     The duplicated string, or NULL on error.
  3094.  
  3095. ALSO SEE
  3096.     strcpy  malloc
  3097.  
  3098. EXAMPLE
  3099.     main ()
  3100.     {
  3101.         int result;
  3102.         char *p, str[80];
  3103.  
  3104.         strcpy (str,"Difficult is relative");
  3105.  
  3106.         p = strdup (str);                       // Duplicate the string
  3107.  
  3108.         if (p) {
  3109.             printf ("%s\n",p);
  3110.             free (p);                           // Free the storage
  3111.         }
  3112.         else printf ("strdup failed, out of memory?\n");
  3113.     }
  3114.  
  3115. ----------------------------------------------------------------------
  3116.  
  3117. NAME
  3118.     stricmp
  3119.  
  3120. DESCRIPTION
  3121.     Lexicographically compare two null terminated strings ignoring
  3122.     case and return an integer based on the outcome.
  3123.  
  3124. SYNOPSIS
  3125.     int stricmp (char * str1, char * str2)
  3126.  
  3127. INPUTS
  3128.     str1    -   The first string to compare.
  3129.     str2    -   The second string to compare.
  3130.  
  3131. RETURN VALUE
  3132.     Less than 0     -   str1 is less than str2.
  3133.     0               -   str1 equals str2.
  3134.     Greater than 0  -   str1 is greater than str2.
  3135.  
  3136. ALSO SEE
  3137.     strcmp
  3138.  
  3139. EXAMPLE
  3140.     main ()
  3141.     {
  3142.         int result;
  3143.         char str1[80], str2[80];
  3144.  
  3145.         strcpy (str1,"Green"); strcpy (str2,"Peace");
  3146.  
  3147.         result = stricmp (str1,str2);
  3148.  
  3149.         if (result) {
  3150.             if (result>0) printf ("str1 is greater than str2\n");
  3151.             else printf ("str1 is less than str2\n");
  3152.         }
  3153.         else printf ("str1 equals str2\n");
  3154.     }
  3155.  
  3156. ----------------------------------------------------------------------
  3157.  
  3158. NAME
  3159.     strisocc
  3160.  
  3161. DESCRIPTION
  3162.     Count occurances of one string within another. Ignores case of
  3163.     the letters.
  3164.  
  3165. SYNOPSIS
  3166.     int strisocc (char * str1, char * str2)
  3167. INPUTS
  3168.     str1    -   String to search for.
  3169.     str2    -   String to search.
  3170.  
  3171. RETURN VALUE
  3172.     The number of times str1 occurs within str2.
  3173.  
  3174. ALSO SEE
  3175.     strcmp
  3176.  
  3177. EXAMPLE
  3178.     main ()
  3179.     {
  3180.         int result;
  3181.         char str[80];
  3182.  
  3183.         strcpy (str,"Green Peace");
  3184.  
  3185.         result = strisocc ("ee",str);
  3186.  
  3187.         printf ("Occurances: %d\n",result);
  3188.     }
  3189.  
  3190. ----------------------------------------------------------------------
  3191.  
  3192. NAME
  3193.     strlen
  3194.  
  3195. DESCRIPTION
  3196.     Returns the length of a null terminated string.
  3197.  
  3198. SYNOPSIS
  3199.     int strlen (char * str)
  3200.  
  3201. INPUTS
  3202.     str     -   The string to measure.
  3203.  
  3204. RETURN VALUE
  3205.     The length of str.
  3206.  
  3207. ALSO SEE
  3208.     strcpy
  3209.  
  3210. EXAMPLE
  3211.     main ()
  3212.     {
  3213.         int result;
  3214.         char str[80];
  3215.  
  3216.         strcpy (str,"Green Peace");
  3217.  
  3218.         result = strlen (str);
  3219.  
  3220.         printf ("Length: %d\n",result);
  3221.     }
  3222.  
  3223. ----------------------------------------------------------------------
  3224.  
  3225. NAME
  3226.     strncat
  3227.  
  3228. DESCRIPTION
  3229.     Concatenates up to count characters from str2 to str1. The addition is
  3230.     NOT null terminated.
  3231.  
  3232. SYNOPSIS
  3233.     char * strncat (char * str1, char * str2, int count)
  3234.  
  3235. INPUTS
  3236.     str1    -   The string to append to.
  3237.     str2    -   The string to append.
  3238.     count   -   Maximum characters to copy.
  3239.  
  3240. RETURN VALUE
  3241.     str1
  3242.  
  3243. ALSO SEE
  3244.     strcat
  3245.  
  3246. EXAMPLE
  3247.     main ()
  3248.     {
  3249.         int len;
  3250.         char str1[80], str2[80];
  3251.  
  3252.         strcpy (str1,"This is a ");
  3253.         strcpy (str2,"sentance.");
  3254.  
  3255.         len = strlen (str1);                // Save original length
  3256.         strncat (str1,str2,4);              // Append up to 4 characters
  3257.         str1[len+4] = '\0';                 // Terminate the string with null
  3258.  
  3259.         printf ("%s\n",str1);
  3260.     }
  3261.  
  3262. ----------------------------------------------------------------------
  3263.  
  3264. NAME
  3265.     strncmp
  3266.  
  3267. DESCRIPTION
  3268.     Lexicographically compares two null terminated strings up to
  3269.     count characters and returns an integer based on the outcome.
  3270.  
  3271. SYNOPSIS
  3272.     int strncmp (char * str1, char * str2, int count)
  3273.  
  3274. INPUTS
  3275.     str1    -   The first string to compare.
  3276.     str2    -   The second string to compare.
  3277.     count   -   Maximum characters to compare.
  3278.  
  3279. RETURN VALUE
  3280.     Less than 0     -   str1 is less than str2.
  3281.     0               -   str1 equals str2.
  3282.     Greater than 0  -   str1 is greater than str2.
  3283.  
  3284. ALSO SEE
  3285.     strcmp
  3286.  
  3287. EXAMPLE
  3288.     main ()
  3289.     {
  3290.         int result;
  3291.         char str1[80], str2[80];
  3292.  
  3293.         strcpy (str1,"Green"); strcpy (str2,"GreenPeace");
  3294.  
  3295.         result = strncmp (str1,str2,4);
  3296.  
  3297.         if (result) {
  3298.             if (result>0) printf ("str1 is greater than str2\n");
  3299.             else printf ("str1 is less than str2\n");
  3300.         }
  3301.         else printf ("str1 equals str2\n");
  3302.     }
  3303.  
  3304. ----------------------------------------------------------------------
  3305.  
  3306. NAME
  3307.     strncpy
  3308.  
  3309. DESCRIPTION
  3310.     Copies up to count characters from  null terminated string str1 to str2.
  3311.  
  3312. SYNOPSIS
  3313.     char * strncpy (char * str1, char * str2, int count)
  3314.  
  3315. INPUTS
  3316.     str1    -   The destination string.
  3317.     str2    -   The string to be copied.
  3318.     count   -   Maximum characters to copy.
  3319.  
  3320. RETURN VALUE
  3321.     str1
  3322.  
  3323. ALSO SEE
  3324.     strcpy
  3325.  
  3326. EXAMPLE
  3327.     main ()
  3328.     {
  3329.         int result;
  3330.         char str1[80], str2[80];
  3331.  
  3332.         strcpy (str1,"Difficult is relative");
  3333.  
  3334.         strncpy (str2,str1,9);              // Copy 9 characters
  3335.         str2[9] = '\0';                     // Terminate the string with null
  3336.  
  3337.         printf ("%s\n",str2);
  3338.     }
  3339.  
  3340. ----------------------------------------------------------------------
  3341.  
  3342. NAME
  3343.     strnicmp
  3344.  
  3345. DESCRIPTION
  3346.     Lexicographically compare two null terminated strings up to
  3347.     count characters ignoring case and return an integer based
  3348.     on the outcome.
  3349.  
  3350. SYNOPSIS
  3351.     int strnicmp (char * str1, char * str2, int count)
  3352.  
  3353. INPUTS
  3354.     str1    -   The first string to compare.
  3355.     str2    -   The second string to compare.
  3356.     count   -   Maximum characters to compare.
  3357.  
  3358. RETURN VALUE
  3359.     Less than 0     -   str1 is less than str2.
  3360.     0               -   str1 equals str2.
  3361.     Greater than 0  -   str1 is greater than str2.
  3362.  
  3363. ALSO SEE
  3364.     strcmp
  3365.  
  3366. EXAMPLE
  3367.     main ()
  3368.     {
  3369.         int result;
  3370.         char str1[80], str2[80];
  3371.  
  3372.         strcpy (str1,"Green"); strcpy (str2,"greenpeace");
  3373.  
  3374.         result = strnicmp (str1,str2,4);
  3375.  
  3376.         if (result) {
  3377.             if (result>0) printf ("str1 is greater than str2\n");
  3378.             else printf ("str1 is less than str2\n");
  3379.         }
  3380.         else printf ("str1 equals str2\n");
  3381.     }
  3382.  
  3383. ----------------------------------------------------------------------
  3384.  
  3385. NAME
  3386.     strrchr
  3387.  
  3388. DESCRIPTION
  3389.     Returns the last occurance of ch in string str, NULL if not found.
  3390.  
  3391. SYNOPSIS
  3392.     char * strrchr (char * str, int ch)
  3393.  
  3394. INPUTS
  3395.     str     -   The string to search.
  3396.     ch      -   The character to search for.
  3397.  
  3398. RETURN VALUE
  3399.     Pointer to the character, or NULL if not found.
  3400.  
  3401. ALSO SEE
  3402.     strchr  strstr
  3403.  
  3404. EXAMPLE
  3405.     main ()
  3406.     {
  3407.         char *p, str[80];
  3408.  
  3409.         strcpy (str,"This is a sentance.\n");
  3410.  
  3411.         p = strrchr (str,'a');
  3412.  
  3413.         if (p) printf ("%s",p);
  3414.         else printf ("Character not found\n");
  3415.     }
  3416.  
  3417. ----------------------------------------------------------------------
  3418.  
  3419. NAME
  3420.     strstr
  3421.  
  3422. DESCRIPTION
  3423.     Returns the first occurance of str2 in string str1, NULL if not found.
  3424.     This is a case sensitive search, see strisocc for a similar
  3425.     non-case sensitive function.
  3426.  
  3427. SYNOPSIS
  3428.     char * strstr (char * str1, char * str2)
  3429.  
  3430. INPUTS
  3431.     str1    -   The string to search.
  3432.     str2    -   The string to search for.
  3433.  
  3434. RETURN VALUE
  3435.     The found string, or NULL if not found.
  3436.  
  3437. ALSO SEE
  3438.     strchr  strrchr  strisocc
  3439.  
  3440. EXAMPLE
  3441.     main ()
  3442.     {
  3443.         char *p, str[80];
  3444.  
  3445.         strcpy (str,"Green Peace");
  3446.  
  3447.         p = strstr (str,"ee");
  3448.  
  3449.         if (p) printf ("Found: %s\n",p);
  3450.         else printf ("String not found\n");
  3451.     }
  3452.  
  3453. ----------------------------------------------------------------------
  3454.  
  3455. NAME
  3456.     StrToDate
  3457.  
  3458. DESCRIPTION
  3459.     Returns the integer date version of a character string.
  3460.  
  3461. SYNOPSIS
  3462.     int StrToDate (char * date)
  3463.  
  3464. INPUTS
  3465.     date    -   The date string to convert to integer format.
  3466.  
  3467. RETURN VALUE
  3468.     The integer form of the string date.
  3469.  
  3470. ALSO SEE
  3471.     DateToStr
  3472.  
  3473. EXAMPLE
  3474.     main ()
  3475.     {
  3476.         if (BaseOpen ("USER.BBS")) {    // Open user base
  3477.             BaseRead (1);               // Read sysop record
  3478.  
  3479.             // Set sysop last call date to 01-01-80
  3480.             USRludate = StrToDate ("01-01-80");
  3481.  
  3482.             BaseWrite (1);              // Write the sysop record
  3483.             BaseClose ();               // Close user base
  3484.         }
  3485.     }
  3486.  
  3487. ----------------------------------------------------------------------
  3488.  
  3489. NAME
  3490.     strtok
  3491.  
  3492. DESCRIPTION
  3493.     Returns a pointer to the next token in string str1. The characters
  3494.     contained in str2 are the delimiters that determine the token. A
  3495.     NULL pointer is returned when there is no token to return. The first
  3496.     time strtok is used str1 is actually used in the call. Subsequent
  3497.     calls use a null pointer for the first argument. In this way the
  3498.     entire string can be reduced to tokens. strtok DOES modify the
  3499.     string pointed to by str1. Each time strtok is called a null is
  3500.     placed where the delimiter was found.
  3501.  
  3502. SYNOPSIS
  3503.     char * strtok (char * str1, char * str2)
  3504.  
  3505. INPUTS
  3506.     str1    -   Token source string.
  3507.     str2    -   Delimiter string.
  3508.  
  3509. RETURN VALUE
  3510.     The next token, or NULL if none available.
  3511.  
  3512. ALSO SEE
  3513.     strstr
  3514.  
  3515. EXAMPLE
  3516.     main ()
  3517.     {
  3518.         char *p, str[80];
  3519.  
  3520.         strcpy (str,"This is a text string.");
  3521.  
  3522.         if ((p = strtok (str," \t\n\r")) != NULL) {
  3523.             do {
  3524.                 printf ("Token: %s\n",p);
  3525.             } while ((p = strtok (NULL," \t\n\r")) != NULL);
  3526.         }
  3527.     }
  3528.  
  3529. ----------------------------------------------------------------------
  3530.  
  3531. NAME
  3532.     StrToTime
  3533.  
  3534. DESCRIPTION
  3535.     Returns the integer time version of a character string.
  3536.  
  3537. SYNOPSIS
  3538.     int StrToTime (char * date)
  3539.  
  3540. INPUTS
  3541.     date    -   The time string to convert to integer format.
  3542.  
  3543. RETURN VALUE
  3544.     The integer form of the string time.
  3545.  
  3546. ALSO SEE
  3547.     TimeToStr
  3548.  
  3549. EXAMPLE
  3550.     main ()
  3551.     {
  3552.         if (BaseOpen ("USER.BBS")) {    // Open user base
  3553.             BaseRead (1);               // Read sysop record
  3554.  
  3555.             // Set sysop last call time to 00:00:00
  3556.             USRlutime = StrToTime ("00:00:00");
  3557.  
  3558.             BaseWrite (1);              // Write the sysop record
  3559.             BaseClose ();               // Close user base
  3560.         }
  3561.     }
  3562.  
  3563. ----------------------------------------------------------------------
  3564.  
  3565. NAME
  3566.     SysDate
  3567.  
  3568. DESCRIPTION
  3569.     Return the integer form of the current system date.
  3570.  
  3571. SYNOPSIS
  3572.     int SysDate (void)
  3573.  
  3574. INPUTS
  3575.     None
  3576.  
  3577. RETURN VALUE
  3578.     The integer system date.
  3579.  
  3580. ALSO SEE
  3581.     SysTime  DateToStr
  3582.  
  3583. EXAMPLE
  3584.     main ()
  3585.     {
  3586.         int date;
  3587.  
  3588.         date = SysDate ();
  3589.         printf ("Today's date: %s\n",DateToStr (date));
  3590.     }
  3591.  
  3592. ----------------------------------------------------------------------
  3593.  
  3594. NAME
  3595.     SysLog
  3596.  
  3597. DESCRIPTION
  3598.     Write a system log entry. The Maximus / Binkley / Opus log format
  3599.     is used. If logfile exists str is appended, else the file is
  3600.     created.
  3601.  
  3602. SYNOPSIS
  3603.     int SysLog (char * logfile, char * str)
  3604.  
  3605. INPUTS
  3606.     logfile -   The log file path and name.
  3607.     str     -   The character string to log.
  3608.  
  3609. RETURN VALUE
  3610.     Zero on failure, non-zero on success.
  3611.  
  3612. ALSO SEE
  3613.  
  3614. EXAMPLE
  3615.     main ()
  3616.     {
  3617.         SysLog ("TEMP.LOG","Run begin");  // Post a log entry
  3618.     }
  3619.  
  3620. ----------------------------------------------------------------------
  3621.  
  3622. NAME
  3623.     system
  3624.  
  3625. DESCRIPTION
  3626.     Execute a system command. Standard output from the command is
  3627.     redirected to nul.
  3628.  
  3629. SYNOPSIS
  3630.     void system (char *cmd)
  3631.  
  3632. INPUTS
  3633.     cmd     -   The command to execute.
  3634.  
  3635. RETURN VALUE
  3636.     None
  3637.  
  3638. ALSO SEE
  3639.  
  3640. EXAMPLE
  3641.     main ()
  3642.     {
  3643.         long fp;
  3644.  
  3645.         // Create a temporary file
  3646.         fp = fopen ("TEMP.TMP","wb");
  3647.         if (fp == NULL) exit (1);
  3648.         fclose (fp);
  3649.  
  3650.         system ("del TEMP.TMP"); // Delete the file
  3651.     }
  3652.  
  3653. ----------------------------------------------------------------------
  3654.  
  3655. NAME
  3656.     SysTime
  3657.  
  3658. DESCRIPTION
  3659.     Return the integer form of the current system time.
  3660.  
  3661. SYNOPSIS
  3662.     int SysTime (void)
  3663.  
  3664. INPUTS
  3665.     None
  3666.  
  3667. RETURN VALUE
  3668.     The integer system time.
  3669.  
  3670. ALSO SEE
  3671.     SysDate  TimeToStr
  3672.  
  3673. EXAMPLE
  3674.     main ()
  3675.     {
  3676.         int time;
  3677.  
  3678.         time = SysTime ();
  3679.         printf ("Current time: %s\n",TimeToStr (time));
  3680.     }
  3681.  
  3682. ----------------------------------------------------------------------
  3683.  
  3684. NAME
  3685.     TimeToStr
  3686.  
  3687. DESCRIPTION
  3688.     Returns string representation of the integer time parameter.
  3689.  
  3690. SYNOPSIS
  3691.     char * TimeToStr (int time)
  3692. INPUTS
  3693.     time    -   integer time value.
  3694.  
  3695. RETURN VALUE
  3696.     String representation of an integer time value.
  3697.  
  3698. ALSO SEE
  3699.     DateToStr  USRlutime SysTime  SysDate
  3700.  
  3701. EXAMPLE
  3702.     main ()
  3703.     {
  3704.         int time;
  3705.  
  3706.         time = SysTime ();
  3707.         printf ("Current time: %s\n",TimeToStr (time));
  3708.     }
  3709.  
  3710. ----------------------------------------------------------------------
  3711.  
  3712. NAME
  3713.     tolower
  3714.  
  3715. DESCRIPTION
  3716.     Returns the lower case equivalent of ch if ch is a character, else
  3717.     ch is returned.
  3718.  
  3719. SYNOPSIS
  3720.     int tolower (int ch)
  3721.  
  3722. INPUTS
  3723.     ch      -   The character to convert to lower caser.
  3724.  
  3725. RETURN VALUE
  3726.     The lower case equivalent of the character.
  3727.  
  3728. ALSO SEE
  3729.     toupper
  3730.  
  3731. EXAMPLE
  3732.     main ()
  3733.     {
  3734.         int ch = 'C';
  3735.  
  3736.         printf ("%c\n",tolower (ch));
  3737.     }
  3738.  
  3739. ----------------------------------------------------------------------
  3740.  
  3741. NAME
  3742.     toupper
  3743.  
  3744. DESCRIPTION
  3745.     Returns the upper case equivalent of ch if ch is a character, else
  3746.     ch is returned.
  3747.  
  3748. SYNOPSIS
  3749.     int toupper (int ch)
  3750.  
  3751. INPUTS
  3752.     ch      -   The character to convert to upper caser.
  3753.  
  3754. RETURN VALUE
  3755.     The upper case equivalent of the character.
  3756.  
  3757. ALSO SEE
  3758.     tolower
  3759.  
  3760. EXAMPLE
  3761.     main ()
  3762.     {
  3763.         int ch = 'c';
  3764.  
  3765.         printf ("%c\n",toupper (ch));
  3766.     }
  3767.  
  3768. ----------------------------------------------------------------------
  3769.  
  3770. NAME
  3771.     Wclose
  3772.  
  3773. DESCRIPTION
  3774.     Close a screen window.
  3775.  
  3776. SYNOPSIS
  3777.     int Wclose (void)
  3778.  
  3779. INPUTS
  3780.     None
  3781.  
  3782. RETURN VALUE
  3783.     Zero on success, non-zero on error.
  3784.  
  3785. ALSO SEE
  3786.     Wopen
  3787.  
  3788. EXAMPLE
  3789.     main ()
  3790.     {
  3791.         int colour = Attr (WHITE,BLUE);
  3792.  
  3793.         if (Wopen (16,21,20,59,0,colour,colour)) {
  3794.             Wxyputs (1,1,colour,"    Press any key to continue ..");
  3795.             Hidecur ();         // Hide the cursor
  3796.             while (!kbhit()) ;  // Wait until key hit
  3797.             getch ();           // Clear the key
  3798.             Wclose ();          // Close the window
  3799.             Showcur ();         // Show the cursor
  3800.         }
  3801.     }
  3802.  
  3803. ----------------------------------------------------------------------
  3804.  
  3805. NAME
  3806.     Wfillch
  3807.  
  3808. DESCRIPTION
  3809.     Specifies the character the windowing system will fill windows with.
  3810.     The default is the space character.
  3811.  
  3812. SYNOPSIS
  3813.     void Wfillch (int ch)
  3814.  
  3815. INPUTS
  3816.     ch      -   The fill character.
  3817.  
  3818. RETURN VALUE
  3819.     None
  3820.  
  3821. ALSO SEE
  3822.     Wopen
  3823.  
  3824. EXAMPLE
  3825.     main ()
  3826.     {
  3827.         int colour = Attr (WHITE,CYAN);
  3828.  
  3829.         Wfillch (0xB0); // Set a graphics fill character
  3830.         if (Wopen (0,0,24,79,0,colour,colour)) {
  3831.             Hidecur ();         // Hide the cursor
  3832.             Pause (54);         // Wait for 3 seconds
  3833.             Wclose ();          // Close the window
  3834.             Showcur ();         // Show the cursor
  3835.         }
  3836.     }
  3837.  
  3838. ----------------------------------------------------------------------
  3839.  
  3840. NAME
  3841.     Wgotoxy
  3842.  
  3843. DESCRIPTION
  3844.     Sets cursor coordinates within the active window.
  3845.  
  3846. SYNOPSIS
  3847.     int Wgotoxy (int wrow, int wcol)
  3848.  
  3849. INPUTS
  3850.     wrow    -   Window row (Y coordinate).
  3851.     wcol    -   Window column (X coordinate).
  3852.  
  3853. RETURN VALUE
  3854.     Zero on no error, non-zero on error.
  3855.  
  3856. ALSO SEE
  3857.  
  3858. EXAMPLE
  3859.     main ()
  3860.     {
  3861.         int colour = Attr (WHITE,MAGENTA);
  3862.  
  3863.         if (Wopen (0,0,24,79,1,Attr (YELLOW,MAGENTA),colour)) {
  3864.             Hidecur ();         // Hide the cursor
  3865.             Wgotoxy (11,21);
  3866.             Wputs ("Welcome to the Maximus User Language");
  3867.             Pause (54);         // Wait for 3 seconds
  3868.             Wclose ();          // Close the window
  3869.             Showcur ();         // Show the cursor
  3870.         }
  3871.     }
  3872.  
  3873. ----------------------------------------------------------------------
  3874.  
  3875. NAME
  3876.     Whline
  3877.  
  3878. DESCRIPTION
  3879.     "Draws" a horizontal text line in active window using characters
  3880.     defined by given box type. If horizontal line crosses a vertical
  3881.     line of the same box type, an appropriate intersection or corner
  3882.     will be used.
  3883.  
  3884. SYNOPSIS
  3885.     int whline (int wsrow, int wscol, int count, int btype, int attr)
  3886.  
  3887. INPUTS
  3888.     wsrow   -   Window start row.
  3889.     wscol   -   Window start column.
  3890.     count   -   Number of line characters to display.
  3891.     btype   -   Box type.  Can be one of the following:
  3892.                 0 - single line
  3893.                 1 - double line
  3894.                 2 - single horz, double vert line
  3895.                 3 - double horz, single vert line
  3896.                 4 - thick line
  3897.                 5 - uses spaces for line chars
  3898.     attr    -   Text attribute to use for the line.
  3899.  
  3900. RETURN VALUE
  3901.     Zero on no error, non-zero on error.
  3902.  
  3903. ALSO SEE
  3904.     Wvline
  3905.  
  3906. EXAMPLE
  3907.     main ()
  3908.     {
  3909.         int colour = Attr (YELLOW,BROWN);
  3910.  
  3911.         if (Wopen (0,0,24,79,3,colour,Attr (WHITE,BROWN))) {
  3912.             Hidecur ();         // Hide the cursor
  3913.             Whline (10,0,79,3,colour);
  3914.             Wgotoxy (11,21);
  3915.             Wputs ("Welcome to the Maximus User Language");
  3916.             Whline (12,0,79,3,colour);
  3917.             Pause (54);         // Wait for 3 seconds
  3918.             Wclose ();          // Close the window
  3919.             Showcur ();         // Show the cursor
  3920.         }
  3921.     }
  3922.  
  3923. ----------------------------------------------------------------------
  3924.  
  3925. NAME
  3926.     Wopen
  3927.  
  3928. DESCRIPTION
  3929.     Opens a screen window and makes it active. The cursor location will
  3930.     be initialized to window row 0, column 0. The text attribute will be
  3931.     initialized to the same attribute as the window. You can open as
  3932.     many windows as memory permits.
  3933.  
  3934. SYNOPSIS
  3935.     int wopen (int srow, int scol, int erow, int ecol, int btype,
  3936.                int battr, int wattr)
  3937.  
  3938. INPUTS
  3939.     srow    -   Starting row.
  3940.     scol    -   Starting column.
  3941.     erow    -   Ending row.
  3942.     ecol    -   Ending column.
  3943.     btype   -   Box type.  Can be one of the following:
  3944.                 0 - single line border
  3945.                 1 - double line border
  3946.                 2 - single horz, double vert line border
  3947.                 3 - double horz, single vert line border
  3948.                 4 - thick line border
  3949.                 5 - no border (uses spaces for border chars).  A
  3950.                 borderless window has a greater effective window
  3951.                 area than a window with a border.
  3952.     battr   -   Attribute of window's border.
  3953.     wattr   -   Attribute of window (and initially the text).
  3954.  
  3955. RETURN VALUE
  3956.     Non-zero on success, zero on error.
  3957.  
  3958. ALSO SEE
  3959.     Wclose
  3960.  
  3961. EXAMPLE
  3962.     main ()
  3963.     {
  3964.         int i, colour, fc, bc, srow, scol, erow, ecol;
  3965.  
  3966.         srand (SysTime ());             // Setup the random generator
  3967.         Hidecur ();                     // Hide the cursor
  3968.  
  3969.         for (i=0;i<100;++i) {           // Open 100 windows
  3970.             srow = rand () % 23;
  3971.             erow = rand () % (23 - srow) + srow + 2;
  3972.             scol = rand () % 78;
  3973.             ecol = rand () % (78 - scol) + scol + 2;
  3974.             fc = rand () % 16; bc = rand () % 7;
  3975.             if (fc == bc) { fc = WHITE; bc = BLUE; }
  3976.             colour = Attr (fc,bc);
  3977.             if (!Wopen (srow,scol,erow,ecol,0,colour,colour)) break;
  3978.         }
  3979.  
  3980.         Pause (54);                     // Wait for 3 seconds
  3981.  
  3982.         for (;i>0;--i) Wclose ();       // Close the windows
  3983.         Showcur ();                     // Show the cursor
  3984.     }
  3985.  
  3986. ----------------------------------------------------------------------
  3987.  
  3988. NAME
  3989.     Wprintf
  3990.  
  3991. DESCRIPTION
  3992.     Formated print to the active window.
  3993.  
  3994. SYNOPSIS
  3995.     int Wprintf (char *format_string, ... )
  3996.  
  3997. INPUTS
  3998.     format_string   -   Format character string.
  3999.     ...             -   Variable number of additional parameters.
  4000.  
  4001.     Format type         Meaning
  4002.     -----------         -------
  4003.     %d              -   display an integer as a signed decimal string
  4004.     %u              -   display an integer as an unsigned decimal string
  4005.     %x              -   display an integer as a hexidecimal string
  4006.     %o              -   display an integer as an octal string
  4007.     %b              -   display an integer as a binary string
  4008.     %c              -   display a character
  4009.     %s              -   display a character string
  4010.  
  4011.     Format modifiers
  4012.     ----------------
  4013.     -               -   left justify         e.g. %-10s
  4014.     digits          -   numeric field width. e.g. %10s
  4015.     l               -   long value.          e.g. %ld
  4016.  
  4017.     Note that all MUL function calls have a maximum parameter count
  4018.     of sixteen values.
  4019.  
  4020.     Escape sequences
  4021.     ----------------
  4022.     \n              -   newline character
  4023.     \t              -   tab character
  4024.     \f              -   formfeed character
  4025.     \a              -   bell character
  4026.     \b              -   backspace character
  4027.     \r              -   return character
  4028.     \0              -   null character
  4029.     \?              -   all other values print the literal character.
  4030.                         e.g. \"    \'    \\
  4031.  
  4032. RETURN VALUE
  4033.     Number of characters written.
  4034.  
  4035. ALSO SEE
  4036.     printf  fprintf  sprintf
  4037.  
  4038. EXAMPLE
  4039.     main ()
  4040.     {
  4041.         int i = 42, colour = Attr (BLACK,LGREY);
  4042.  
  4043.         if (Wopen (0,0,24,79,3,colour,colour)) {
  4044.             Wprintf ("The answer is %d",i);
  4045.             Pause (54);         // Wait for 3 seconds
  4046.             Wclose ();          // Close the window
  4047.         }
  4048.     }
  4049.  
  4050. ----------------------------------------------------------------------
  4051.  
  4052. NAME
  4053.     Wputch
  4054.  
  4055. DESCRIPTION
  4056.     Display a character in the active window at the current cursor
  4057.     position.
  4058.  
  4059. SYNOPSIS
  4060.     int Wputch (int ch)
  4061.  
  4062. INPUTS
  4063.     ch      -   The character to be displayed.
  4064.  
  4065. RETURN VALUE
  4066.     Zero on success, non-zero on error.
  4067.  
  4068. ALSO SEE
  4069.     Wputs  Wprintf
  4070.  
  4071. EXAMPLE
  4072.     main ()
  4073.     {
  4074.         int colour = Attr (BLUE,LGREY);
  4075.  
  4076.         if (Wopen (0,0,24,79,3,colour,colour)) {
  4077.             Wputch ('M');
  4078.             Wputch ('U');
  4079.             Wputch ('L');
  4080.             Pause (54);         // Wait for 3 seconds
  4081.             Wclose ();          // Close the window
  4082.         }
  4083.     }
  4084.  
  4085. ----------------------------------------------------------------------
  4086.  
  4087. NAME
  4088.     Wputs
  4089.  
  4090. DESCRIPTION
  4091.     Display a string in the active window at the current cursor
  4092.     location.
  4093.  
  4094. SYNOPSIS
  4095.     int Wputs (char * str)
  4096.  
  4097. INPUTS
  4098.     str     -   The string to display.
  4099.  
  4100. RETURN VALUE
  4101.     Zero on success, non-zero on error.
  4102.  
  4103. ALSO SEE
  4104.     Wputch  Wprintf
  4105.  
  4106. EXAMPLE
  4107.     main ()
  4108.     {
  4109.         int colour = Attr (RED,LGREY);
  4110.  
  4111.         if (Wopen (0,0,24,79,3,colour,colour)) {
  4112.             Wputs ("MUL");
  4113.             Pause (54);         // Wait for 3 seconds
  4114.             Wclose ();          // Close the window
  4115.         }
  4116.     }
  4117.  
  4118. ----------------------------------------------------------------------
  4119.  
  4120. NAME
  4121.     Wshadow
  4122.  
  4123. DESCRIPTION
  4124.     Add a shadow to the active window. The Wclose function will
  4125.     automatically remove the shadow when the window is closed.
  4126.  
  4127. SYNOPSIS
  4128.     int Wshadow (int attr)
  4129.  
  4130. INPUTS
  4131.     attr    -   The attribute to use for the shadow. (LGREY,BLACK) is
  4132.                 the usual attribute used.
  4133.  
  4134. RETURN VALUE
  4135.     Zero on success, non-zero on error.
  4136.  
  4137. ALSO SEE
  4138.  
  4139. EXAMPLE
  4140.     main ()
  4141.     {
  4142.         int colour1 = Attr (RED,LGREY);
  4143.         int colour2 = Attr (WHITE,BLUE);
  4144.  
  4145.         Hidecur ();                 // Hide the cursor
  4146.  
  4147.         // Open a background window
  4148.         if (Wopen (0,0,24,79,3,colour1,colour1)) {
  4149.  
  4150.             // Open a window to shadow
  4151.             if (Wopen (16,21,20,59,0,colour2,colour2)) {
  4152.                 Wshadow (Attr (LGREY,BLACK));
  4153.                 Pause (54);         // Wait for 3 seconds
  4154.                 Wclose ();          // Close the window
  4155.             }
  4156.  
  4157.             Wclose ();              // Close the background window
  4158.         }
  4159.  
  4160.         Showcur ();                 // Show the cursor
  4161.     }
  4162.  
  4163. ----------------------------------------------------------------------
  4164.  
  4165. NAME
  4166.     Wvline
  4167.  
  4168. DESCRIPTION
  4169.     "Draws" a vertical text line in active window using characters
  4170.     defined by given box type. If vertical line crosses a horizontal
  4171.     line of the same box type, an appropriate intersection or corner
  4172.     will be used.
  4173.  
  4174. SYNOPSIS
  4175.     int wvline (int wsrow, int wscol, int count, int btype, int attr)
  4176.  
  4177. INPUTS
  4178.     wsrow   -   Window start row.
  4179.     wscol   -   Window start column.
  4180.     count   -   Number of line characters to display.
  4181.     btype   -   Box type.  Can be one of the following:
  4182.                 0 - single line
  4183.                 1 - double line
  4184.                 2 - single horz, double vert line
  4185.                 3 - double horz, single vert line
  4186.                 4 - thick line
  4187.                 5 - uses spaces for line chars
  4188.     attr    -   Text attribute to use for the line.
  4189.  
  4190. RETURN VALUE
  4191.     Zero on no error, non-zero on error.
  4192.  
  4193. ALSO SEE
  4194.     Whline
  4195.  
  4196. EXAMPLE
  4197.     main ()
  4198.     {
  4199.         int colour = Attr (YELLOW,BROWN);
  4200.  
  4201.         if (Wopen (0,0,24,79,3,colour,Attr (WHITE,BROWN))) {
  4202.             Hidecur ();         // Hide the cursor
  4203.             Wvline (0,19,25,3,colour);
  4204.             Wgotoxy (11,21);
  4205.             Wputs ("Welcome to the Maximus User Language");
  4206.             Wvline (0,58,25,3,colour);
  4207.             Pause (54);         // Wait for 3 seconds
  4208.             Wclose ();          // Close the window
  4209.             Showcur ();         // Show the cursor
  4210.         }
  4211.     }
  4212.  
  4213. ----------------------------------------------------------------------
  4214.  
  4215. NAME
  4216.     Wxyprintf
  4217.  
  4218. DESCRIPTION
  4219.     Formated print to the active window at srow and scol, using
  4220.     colour attribute attr.
  4221.  
  4222. SYNOPSIS
  4223.     int Wxyprintf (int srow, int scol, int attr, char *format_string, ... )
  4224.  
  4225. INPUTS
  4226.     srow            -   Starting row.
  4227.     scol            -   Starting column.
  4228.     attr            -   The colour attribute to use.
  4229.     format_string   -   Format character string.
  4230.     ...             -   Variable number of additional parameters.
  4231.  
  4232.     Format type         Meaning
  4233.     -----------         -------
  4234.     %d              -   display an integer as a signed decimal string
  4235.     %u              -   display an integer as an unsigned decimal string
  4236.     %x              -   display an integer as a hexidecimal string
  4237.     %o              -   display an integer as an octal string
  4238.     %b              -   display an integer as a binary string
  4239.     %c              -   display a character
  4240.     %s              -   display a character string
  4241.  
  4242.     Format modifiers
  4243.     ----------------
  4244.     -               -   left justify         e.g. %-10s
  4245.     digits          -   numeric field width. e.g. %10s
  4246.     l               -   long value.          e.g. %ld
  4247.  
  4248.     Note that all MUL function calls have a maximum parameter count
  4249.     of sixteen values.
  4250.  
  4251.     Escape sequences
  4252.     ----------------
  4253.     \n              -   newline character
  4254.     \t              -   tab character
  4255.     \f              -   formfeed character
  4256.     \a              -   bell character
  4257.     \b              -   backspace character
  4258.     \r              -   return character
  4259.     \0              -   null character
  4260.     \?              -   all other values print the literal character.
  4261.                         e.g. \"    \'    \\
  4262.  
  4263. RETURN VALUE
  4264.     Number of characters written.
  4265.  
  4266. ALSO SEE
  4267.     Wprintf  printf
  4268.  
  4269. EXAMPLE
  4270.     main ()
  4271.     {
  4272.         int i = 42, colour = Attr (BLACK,LGREY);
  4273.  
  4274.         if (Wopen (0,0,24,79,3,colour,colour)) {
  4275.             Hidecur ();         // Hide the cursor
  4276.             Wxyprintf (11,30,colour,"The answer is %d",i);
  4277.             Pause (54);         // Wait for 3 seconds
  4278.             Wclose ();          // Close the window
  4279.             Showcur ();         // Show the cursor
  4280.         }
  4281.     }
  4282.  
  4283. ----------------------------------------------------------------------
  4284.  
  4285. NAME
  4286.     Wxyputch
  4287.  
  4288. DESCRIPTION
  4289.     Display a character in the active window at position row and col,
  4290.     using colour attribute attr.
  4291.  
  4292. SYNOPSIS
  4293.     int Wxyputch (int row, int col, int attr, int ch)
  4294.  
  4295. INPUTS
  4296.     row     -   Starting row.
  4297.     col     -   Starting column.
  4298.     attr    -   The colour attribute to use.
  4299.     ch      -   The character to be displayed.
  4300.  
  4301. RETURN VALUE
  4302.     Zero on success, non-zero on error.
  4303.  
  4304. ALSO SEE
  4305.     Wxyputs  Wxyprintf
  4306.  
  4307. EXAMPLE
  4308.     main ()
  4309.     {
  4310.         int colour = Attr (BLUE,LGREY);
  4311.  
  4312.         if (Wopen (0,0,24,79,3,colour,colour)) {
  4313.             Wxyputch (11,36,colour,'M');
  4314.             Wxyputch (11,38,colour,'U');
  4315.             Wxyputch (11,40,colour,'L');
  4316.             Pause (54);         // Wait for 3 seconds
  4317.             Wclose ();          // Close the window
  4318.         }
  4319.     }
  4320.  
  4321. ----------------------------------------------------------------------
  4322.  
  4323. NAME
  4324.     Wxyputs
  4325.  
  4326. DESCRIPTION
  4327.     Display a string in the active window at position row and col,
  4328.     using colour attribute attr.
  4329.  
  4330. SYNOPSIS
  4331.     int Wxyputs (int row, int col, int attr, char * str)
  4332.  
  4333. INPUTS
  4334.     row     -   Starting row.
  4335.     col     -   Starting column.
  4336.     attr    -   The colour attribute to use.
  4337.     str     -   The string to display.
  4338.  
  4339. RETURN VALUE
  4340.     Zero on success, non-zero on error.
  4341.  
  4342. ALSO SEE
  4343.     Wxyputch  Wxyprintf
  4344.  
  4345. EXAMPLE
  4346.     main ()
  4347.     {
  4348.         int colour = Attr (LBLUE,LGREY);
  4349.  
  4350.         if (Wopen (0,0,24,79,3,colour,colour)) {
  4351.             Wxyputs (11,36,colour,"M U L");
  4352.             Pause (54);         // Wait for 3 seconds
  4353.             Wclose ();          // Close the window
  4354.         }
  4355.     }
  4356.  
  4357. ----------------------------------------------------------------------
  4358.  
  4359. NAME
  4360.     Xor
  4361.  
  4362. DESCRIPTION
  4363.     Returns the bitwise XOR of the two arguments.
  4364.  
  4365. SYNOPSIS
  4366.     long Xor (long arg1, long arg2)
  4367.  
  4368. INPUTS
  4369.     arg1        -   First value.
  4370.     arg2        -   Second value.
  4371.  
  4372. RETURN VALUE
  4373.     Value of the bitwise XOR.
  4374.  
  4375. ALSO SEE
  4376.     And  Or  Invert  ShiftLeft  ShiftRight
  4377.  
  4378. EXAMPLE
  4379.     main ()
  4380.     {
  4381.         int value = 1;
  4382.  
  4383.         value = Xor (value,1);
  4384.         printf ("Xored value: %d\n",value);
  4385.         value = Xor (value,1);
  4386.         printf ("Xored value: %d\n",value);
  4387.     }
  4388.  
  4389. ----------------------------------------------------------------------
  4390.  
  4391. NAME
  4392.     YesNo
  4393.  
  4394. DESCRIPTION
  4395.     Returns a "YES" or " NO" string to indicate the logical value
  4396.     of the argument.
  4397.  
  4398. SYNOPSIS
  4399.     char * YesNo (long value)
  4400.  
  4401. INPUTS
  4402.     value   -   The value to test.
  4403.  
  4404. RETURN VALUE
  4405.     String representating the logical value of the value.
  4406.  
  4407. ALSO SEE
  4408.  
  4409. EXAMPLE
  4410.     main ()
  4411.     {
  4412.         int value = 1;
  4413.  
  4414.         printf ("Is the value logically true?: %s\n",YesNo (value));
  4415.     }
  4416.  
  4417. ----------------------------------------------------------------------
  4418.  
  4419.